Skip to content

CLI agent/message commands 100% crash: jiti TDZ ReferenceError in pi-embedded #61875

@hoh-dev-bot

Description

@hoh-dev-bot

Description

All CLI commands that load the plugin runtime (openclaw agent, openclaw message, openclaw tui) crash 100% of the time with a ReferenceError: Cannot access 'n' before initialization in pi-embedded-DWASRjxE.js.

Commands that don't load plugin runtime (openclaw health, openclaw gateway status, openclaw doctor, openclaw dashboard) work fine. Gateway-routed paths (Discord, Dashboard UI) are unaffected.

Environment

  • OpenClaw: 2026.4.5 (3e72c03)
  • Node: v22.16.0
  • Platform: macOS (Darwin 25.3.0, arm64)
  • Install method: curl -fsSL https://openclaw.ai/install.sh | bash

Reproduction

openclaw agent --agent <any> --message "ping"
# 100% crash rate, also with --no-plugins

Stack trace

[openclaw] Failed to start CLI: ReferenceError: Cannot access 'n' before initialization
    at Reflect.get (<anonymous>)
    at Object.get (.../openclaw/node_modules/jiti/dist/jiti.cjs:1:147491)
    at .../openclaw/dist/pi-embedded-DWASRjxE.js:7264:54
    at eval_evalModule (.../jiti/dist/jiti.cjs:1:155533)
    at jitiRequire (.../jiti/dist/jiti.cjs:1:150967)
    at .../jiti/dist/jiti.cjs:1:157987
    at .../openclaw/dist/abort-O9-dSalh.js:8:27
    at eval_evalModule (.../jiti/dist/jiti.cjs:1:155533)

Root cause analysis

pi-embedded-DWASRjxE.js line 7264:

const AllMessageActions = CHANNEL_MESSAGE_ACTION_NAMES;

CHANNEL_MESSAGE_ACTION_NAMES is imported (as minified export n) from message-secret-scope-3Su2G0b3.js. When jiti loads the plugin runtime, it converts ESM to CJS internally. The import chain abort-O9-dSalh.jspi-embedded-DWASRjxE.jsmessage-secret-scope-3Su2G0b3.js has a circular dependency that native ESM handles via live bindings, but jiti's CJS conversion hits a Temporal Dead Zone (TDZ) — the export hasn't been initialized when it's accessed.

Gateway is unaffected because it uses native ESM module loading directly, not jiti.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions