docs/debug/node-issue.md
Running OpenClaw via Node with tsx fails at startup with:
[openclaw] Failed to start CLI: TypeError: __name is not a function
at createSubsystemLogger (.../src/logging/subsystem.ts:203:25)
at .../src/agents/auth-profiles/constants.ts:25:20
This began after switching dev scripts from Bun to tsx (commit 2871657e, 2026-01-06). The same runtime path worked with Bun.
# in repo root
node --version
pnpm install
node --import tsx src/entry.ts status
node --import tsx scripts/repro/tsx-name-repro.ts
node@22): failstsx uses esbuild to transform TS/ESM. esbuild’s keepNames emits a __name helper and wraps function definitions with __name(...).__name exists but is not a function at runtime, which implies the helper is missing or overwritten for this module in the Node 25 loader path.__name helper issues have been reported in other esbuild consumers when the helper is missing or rewritten.2871657e (2026-01-06): scripts changed from Bun to tsx to make Bun optional.openclaw status and gateway:watch worked.Use Bun for dev scripts (current temporary revert).
Use tsgo for repo type checking, then run the built output:
pnpm tsgo
node openclaw.mjs status
Historical note: tsc was used here while debugging this Node/tsx issue, but repo type-check lanes now use tsgo.
Disable esbuild keepNames in the TS loader if possible (prevents __name helper insertion); tsx does not currently expose this.
Test Node LTS (22/24) with tsx to see if the issue is Node 25–specific.
tsx nightly or pin to earlier version if a known regression exists.__name stack trace.