openclaw - ✅(Solved) Fix [Bug]:[Windows] Module initialization error: CHANNEL_IDS not iterable on startup [2 pull requests, 4 comments, 5 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#48832Fetched 2026-04-08 00:52:03
View on GitHub
Comments
4
Participants
5
Timeline
21
Reactions
0
Timeline (top)
referenced ×7cross-referenced ×5commented ×4labeled ×2

OpenClaw fails to start on Windows with module initialization error: CHANNEL_IDS is not iterable

Error Message

OpenClaw fails to start on Windows with module initialization error: CHANNEL_IDS is not iterable

Root Cause

OpenClaw fails to start on Windows with module initialization error: CHANNEL_IDS is not iterable

Fix Action

Fixed

PR fix notes

PR #48839: fix(channels): avoid built-in channel ID init cycles

Description (problem / solution / changelog)

Summary

  • import built-in channel ID constants from the leaf channels/ids module in config/CLI helpers and plugin sorting code
  • keep runtime helpers like normalizeAnyChannelId on channels/registry while avoiding eager constant reads through that heavier module
  • reduce the risk of bundled initialization order regressions that can surface as CHANNEL_IDS / CHAT_CHANNEL_ORDER not iterable during startup

Change Type

  • bug fix

Scope

  • channel ID imports for config validation, CLI channel option resolution, elevated allowlist matching, and channel plugin ordering

User-visible / Behavior Changes

  • startup/build outputs no longer depend on channels/registry to initialize built-in channel ID arrays before config validation and plugin sorting read them
  • fixes Windows startup regression where bundled builds could throw Cannot access 'CHANNEL_IDS' before initialization / CHAT_CHANNEL_ORDER is not iterable

Test plan

  • node scripts/tsdown-build.mjs
  • pnpm exec tsx -e "(async()=>{ const [{CHANNEL_IDS,CHAT_CHANNEL_ORDER}] = await Promise.all([import('./src/channels/registry.ts'), import('./src/config/validation.ts')]); console.log('CHANNEL_IDS', Array.isArray(CHANNEL_IDS), CHANNEL_IDS.length); console.log('CHAT_CHANNEL_ORDER', Array.isArray(CHAT_CHANNEL_ORDER), CHAT_CHANNEL_ORDER.length); })().catch(err=>{ console.error(err); process.exit(1); });"

Closes #48832

Changed files

  • src/auto-reply/reply/elevated-allowlist-matcher.ts (modified, +1/-1)
  • src/channels/plugins/registry.ts (modified, +2/-1)
  • src/channels/plugins/setup-registry.ts (modified, +1/-1)
  • src/cli/channel-options.ts (modified, +1/-1)
  • src/config/schema.ts (modified, +1/-1)
  • src/config/validation.ts (modified, +2/-1)

PR #48885: fix: resolve temporal dead zone issues with CHANNEL_IDS on Windows

Description (problem / solution / changelog)

Description

This PR fixes #48832 where OpenClaw fails to start on Windows with module initialization errors.

Root Cause

Circular dependencies caused CHANNEL_IDS and CHAT_CHANNEL_ORDER to be undefined during module load time on Windows.

Solution

Converted all immediate uses to lazy getters to ensure constants are accessed at runtime when the registry module has fully initialized.

Related Issue

Fixes #48832

Changed files

  • extensions/feishu/src/streaming-card-fix.md (added, +49/-0)
  • src/agents/models-config.providers.ts (modified, +4/-1)
  • src/agents/sandbox/constants.ts (modified, +8/-2)
  • src/auto-reply/reply/elevated-allowlist-matcher.ts (modified, +17/-10)
  • src/cli/channel-options.ts (modified, +9/-3)
  • src/config/schema.ts (modified, +9/-2)
  • src/config/validation.ts (modified, +10/-3)
  • src/infra/net/fetch-guard.ts (modified, +7/-2)
  • src/utils/message-channel.ts (modified, +8/-2)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

OpenClaw fails to start on Windows with module initialization error: CHANNEL_IDS is not iterable

Steps to reproduce

  1. Clone OpenClaw repository on Windows
  2. Run pnpm install
  3. Run node scripts/tsdown-build.mjs
  4. Run node scripts/runtime-postbuild.mjs
  5. Run pnpm start

Expected behavior

OpenClaw should start successfully without any initialization errors

Actual behavior

Failed to start CLI: ReferenceError: Cannot access 'CHANNEL_IDS' before initialization at validateConfigObjectWithPluginsBase (dist/auth-profiles-zaVVXKw4.js:164584:6)

Also getting: TypeError: CHAT_CHANNEL_ORDER is not iterable at dist/auth-profiles-zaVVXKw4.js:141759:6

OpenClaw version

2026.3.14

Operating system

Windows 10 (Build 26200)

Install method

pnpm dev

Model

N/A - This is a build/initialization issue, not model-specific

Provider / routing chain

N/A - Application fails to start before reaching this stage

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

The fix involves modifying the code to ensure that CHANNEL_IDS and CHAT_CHANNEL_ORDER are properly initialized before use.

Step-by-Step Solution

  1. Check the initialization order: Verify that CHANNEL_IDS and CHAT_CHANNEL_ORDER are defined and initialized before they are used in the code.
  2. Use a linter or code analyzer: Tools like ESLint can help identify and fix issues related to variable initialization and scope.
  3. Modify the code: Ensure that CHANNEL_IDS and CHAT_CHANNEL_ORDER are properly initialized and iterable. For example:
// Initialize CHANNEL_IDS as an array
const CHANNEL_IDS = [];

// Initialize CHAT_CHANNEL_ORDER as an array or other iterable
const CHAT_CHANNEL_ORDER = [];

Alternatively, if CHANNEL_IDS and CHAT_CHANNEL_ORDER are supposed to be constants, define them as such:

// Define CHANNEL_IDS as a constant array
const CHANNEL_IDS = Object.freeze(['id1', 'id2', 'id3']);

// Define CHAT_CHANNEL_ORDER as a constant array or other iterable
const CHAT_CHANNEL_ORDER = Object.freeze(['order1', 'order2', 'order3']);
  1. Verify the fix: Run the application again to ensure that the initialization errors are resolved.

Verification

To verify that the fix worked, run the application using pnpm start and check for any initialization errors. The application should start successfully without any errors related to CHANNEL_IDS or CHAT_CHANNEL_ORDER.

Extra Tips

  • Use a linter or code analyzer to identify and fix potential issues related to variable initialization and scope.
  • Ensure that all variables are properly initialized and defined before use.
  • Consider using a code formatter to maintain consistent coding style and reduce errors.

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…

FAQ

Expected behavior

OpenClaw should start successfully without any initialization errors

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]:[Windows] Module initialization error: CHANNEL_IDS not iterable on startup [2 pull requests, 4 comments, 5 participants]