openclaw - ✅(Solved) Fix [Bug]: Gateway crash-loop on 2026.4.9 — ReferenceError: activationSourceConfig is not defined (missing destructured variable in loadOpenClawPlugins) [2 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#64357Fetched 2026-04-11 06:15:13
View on GitHub
Comments
2
Participants
3
Timeline
11
Reactions
0
Author
Timeline (top)
referenced ×5cross-referenced ×4commented ×2

Error Message

Gateway failed to start: ReferenceError: activationSourceConfig is not defined

Root Cause

In the compiled loader file (loader-BSIqIOsD.js), function loadOpenClawPlugins (line ~2334) calls resolvePluginLoadCacheContext(options) and destructures the result:

// line 2336
const { env, cfg, normalized, activationSource, autoEnabledReasons, onlyPluginIds,
  includeSetupOnlyChannelPlugins, preferSetupRuntimeForChannelPlugins, shouldActivate,
  shouldLoadModules, cacheKey, runtimeSubagentMode } = resolvePluginLoadCacheContext(options);

resolvePluginLoadCacheContext returns activationSourceConfig in its result object (line ~2025), but the destructuring above omits it. Later, line ~2446 references activationSourceConfig as a bare variable in a diagnostic log:

if (shouldActivate) logger.warn(`[plugins-diag] ... activation.plugins=${JSON.stringify(activationSourceConfig?.plugins ?? null)}`);

This causes a ReferenceError because activationSourceConfig was never assigned in that scope.

Fix Action

Fix

Add activationSourceConfig to the destructuring:

- const { env, cfg, normalized, activationSource, autoEnabledReasons, ...
+ const { env, cfg, normalized, activationSourceConfig, activationSource, autoEnabledReasons, ...

One-line fix, no behavior change — just extracts a variable that's already returned but never assigned.

PR fix notes

PR #64387: fix(plugins): include activationSourceConfig in loadOpenClawPlugins destructuring

Description (problem / solution / changelog)

Summary

  • resolvePluginLoadCacheContext returns activationSourceConfig in its result object (used to thread the original raw config through to activation-source creation)
  • loadOpenClawPlugins destructures the result but omits activationSourceConfig
  • The compiled build (2026.4.9, loader-BSIqIOsD.js) injects a diagnostic log inside loadOpenClawPlugins that references activationSourceConfig as a bare variable
  • Since the variable was never destructured, this causes ReferenceError: activationSourceConfig is not defined, crash-looping the gateway on every startup attempt

One-line fix

Add activationSourceConfig to the destructuring at loadOpenClawPlugins line ~1092.

Reproduction

  1. Install OpenClaw 2026.4.9 via pnpm/npm
  2. Start the gateway (openclaw gateway start or via LaunchAgent)
  3. Gateway crash-loops: starting...loading configuration…resolving authentication… → crash → repeat every ~4s
  4. ~/.openclaw/logs/gateway.err.log shows: Gateway failed to start: ReferenceError: activationSourceConfig is not defined

Evidence

Gateway error log (repeating every ~4 seconds):

2026-04-10T14:14:03.652+03:00 Gateway failed to start: ReferenceError: activationSourceConfig is not defined
2026-04-10T14:14:07.982+03:00 Gateway failed to start: ReferenceError: activationSourceConfig is not defined
2026-04-10T14:14:12.218+03:00 Gateway failed to start: ReferenceError: activationSourceConfig is not defined

Compiled code trace

In loader-BSIqIOsD.js:

Line ~1996resolvePluginLoadCacheContext declares and returns activationSourceConfig:

const activationSourceConfig = options.activationSourceConfig ?? options.config ?? {};
// ...
return { env, cfg, normalized, activationSourceConfig, activationSource, ... };

Line ~2336loadOpenClawPlugins destructures but omits it:

const { env, cfg, normalized, activationSource, autoEnabledReasons, ... } = resolvePluginLoadCacheContext(options);
//                              ^ missing activationSourceConfig here

Line ~2446 — a diagnostic log references it as a bare variable:

if (shouldActivate) logger.warn(`[plugins-diag] ... activation.plugins=${JSON.stringify(activationSourceConfig?.plugins ?? null)}`);
// ReferenceError: activationSourceConfig is not defined

Environment

  • OpenClaw: 2026.4.9 (0512059)
  • Node.js: v25.9.0
  • OS: macOS 26.3.1 (arm64)

AI-assisted

  • AI-assisted (Claude Code / Opus 4.6)
  • Tested locally: applied equivalent patch to compiled loader-BSIqIOsD.js, confirmed gateway starts successfully
  • I understand what the code does

Related issues

Fixes #64357

Related (same symptom family — false plugins.allow is empty warnings):

  • #62049, #64170, #62521, #63693, #63182

Possibly related (plugin loading crashes/hangs):

  • #64306, #64354

Test plan

  • pnpm build && pnpm check && pnpm test passes
  • Gateway starts without crash-loop on fresh install
  • openclaw doctor no longer shows activationSourceConfig ReferenceError

Changed files

  • scripts/check-no-raw-channel-fetch.mjs (modified, +1/-1)
  • src/plugins/loader.ts (modified, +2/-0)
  • test/scripts/lint-suppressions.test.ts (modified, +1/-0)

PR #64430: fix: keep activationSourceConfig in plugin loader context

Description (problem / solution / changelog)

Summary

  • destructure activationSourceConfig from resolvePluginLoadCacheContext() inside loadOpenClawPlugins
  • explicitly retain the variable in scope so diagnostic paths cannot regress into a ReferenceError
  • add a narrow regression test guarding the loader destructuring

Testing

  • node source guard for src/plugins/loader.ts
  • attempted targeted Vitest run for src/plugins/loader.test.ts (the suite did not complete in this constrained environment, so I kept the explicit regression test in place)

Fixes #64357

Changed files

  • src/plugins/loader.test.ts (modified, +7/-77)
  • src/plugins/loader.ts (modified, +2/-0)

Code Example

Gateway failed to start: ReferenceError: activationSourceConfig is not defined

---

// line 2336
const { env, cfg, normalized, activationSource, autoEnabledReasons, onlyPluginIds,
  includeSetupOnlyChannelPlugins, preferSetupRuntimeForChannelPlugins, shouldActivate,
  shouldLoadModules, cacheKey, runtimeSubagentMode } = resolvePluginLoadCacheContext(options);

---

if (shouldActivate) logger.warn(`[plugins-diag] ... activation.plugins=${JSON.stringify(activationSourceConfig?.plugins ?? null)}`);

---

- const { env, cfg, normalized, activationSource, autoEnabledReasons, ...
+ const { env, cfg, normalized, activationSourceConfig, activationSource, autoEnabledReasons, ...
RAW_BUFFERClick to expand / collapse

Bug Description

OpenClaw 2026.4.9 gateway crash-loops on startup with:

Gateway failed to start: ReferenceError: activationSourceConfig is not defined

The gateway never reaches ready — it loops through loading configuration → resolving authentication → starting → crash every ~4 seconds indefinitely.

Root Cause

In the compiled loader file (loader-BSIqIOsD.js), function loadOpenClawPlugins (line ~2334) calls resolvePluginLoadCacheContext(options) and destructures the result:

// line 2336
const { env, cfg, normalized, activationSource, autoEnabledReasons, onlyPluginIds,
  includeSetupOnlyChannelPlugins, preferSetupRuntimeForChannelPlugins, shouldActivate,
  shouldLoadModules, cacheKey, runtimeSubagentMode } = resolvePluginLoadCacheContext(options);

resolvePluginLoadCacheContext returns activationSourceConfig in its result object (line ~2025), but the destructuring above omits it. Later, line ~2446 references activationSourceConfig as a bare variable in a diagnostic log:

if (shouldActivate) logger.warn(`[plugins-diag] ... activation.plugins=${JSON.stringify(activationSourceConfig?.plugins ?? null)}`);

This causes a ReferenceError because activationSourceConfig was never assigned in that scope.

Fix

Add activationSourceConfig to the destructuring:

- const { env, cfg, normalized, activationSource, autoEnabledReasons, ...
+ const { env, cfg, normalized, activationSourceConfig, activationSource, autoEnabledReasons, ...

One-line fix, no behavior change — just extracts a variable that's already returned but never assigned.

Environment

  • OpenClaw: 2026.4.9 (0512059)
  • Node.js: v25.9.0
  • OS: macOS 26.3.1 (arm64)
  • Install: pnpm global (/opt/homebrew/lib/node_modules/openclaw)

Related Issues

This likely explains or contributes to:

  • #62049 — False-positive "plugins.allow is empty" warning
  • #64170 — normalizePluginsConfig drops slots.contextEngine, false warning
  • #62521 — plugins.allow config ignored, false warning fires 13+ times
  • #63693 — False positive plugins.allow warning from core memory search
  • #63182 — False plugin provenance warnings for npm-installed global plugin

And may relate to:

  • #64306 — CLI commands hang in ensureCliPluginRegistryLoaded (if plugin load crashes silently)
  • #64354 — Memory CLI hangs indefinitely on Linux

extent analysis

TL;DR

Apply the one-line fix to the loadOpenClawPlugins function by adding activationSourceConfig to the destructuring assignment.

Guidance

  • Verify the fix by checking if the activationSourceConfig variable is correctly assigned after the destructuring change.
  • Confirm that the gateway starts up successfully and reaches the ready state without crash-looping.
  • Review related issues (#62049, #64170, #62521, #63693, #63182) to determine if this fix resolves or mitigates those problems.
  • Test the fix on different environments (e.g., Linux) to ensure it's not specific to macOS.

Example

The corrected code should look like this:

const { env, cfg, normalized, activationSourceConfig, activationSource, autoEnabledReasons, onlyPluginIds,
  includeSetupOnlyChannelPlugins, preferSetupRuntimeForChannelPlugins, shouldActivate,
  shouldLoadModules, cacheKey, runtimeSubagentMode } = resolvePluginLoadCacheContext(options);

Notes

This fix assumes that the resolvePluginLoadCacheContext function correctly returns the activationSourceConfig property in its result object.

Recommendation

Apply the workaround by adding activationSourceConfig to the destructuring assignment, as this fix is a simple and targeted solution to the identified issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Gateway crash-loop on 2026.4.9 — ReferenceError: activationSourceConfig is not defined (missing destructured variable in loadOpenClawPlugins) [2 pull requests, 2 comments, 3 participants]