Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
87 lines
2.8 KiB
Markdown
87 lines
2.8 KiB
Markdown
---
|
|
summary: Historical Node + tsx "__name is not a function" crash and its cause
|
|
read_when:
|
|
- Investigating a tsx/esbuild loader crash that mentions a missing __name helper
|
|
title: "Node + tsx crash"
|
|
---
|
|
|
|
# Node + tsx "\_\_name is not a function" crash
|
|
|
|
## Status
|
|
|
|
Resolved. This crash does not reproduce on the current `tsx` version pinned in
|
|
`package.json` (`4.22.3`) or on current Node releases. Kept here in case a
|
|
future `tsx`/esbuild upgrade reintroduces it.
|
|
|
|
## Original symptom
|
|
|
|
Running OpenClaw dev scripts through `tsx` failed at startup with:
|
|
|
|
```text
|
|
[openclaw] Failed to start CLI: TypeError: __name is not a function
|
|
at createSubsystemLogger (src/logging/subsystem.ts)
|
|
at <caller> (src/agents/auth-profiles/constants.ts)
|
|
```
|
|
|
|
Line numbers are omitted; both files have changed since the original crash
|
|
and the specific lines no longer match.
|
|
|
|
This appeared after dev scripts switched from Bun to `tsx` (`2871657e`,
|
|
2026-01-06) to make Bun optional. The equivalent Bun-based path did not crash.
|
|
It was originally observed on Node v25.3.0 on macOS; other platforms that run
|
|
Node 25 were considered likely to be affected too.
|
|
|
|
## Cause
|
|
|
|
`tsx` transforms TS/ESM through esbuild with `keepNames: true` hardcoded in
|
|
its transform options. That setting makes esbuild wrap named function/class
|
|
declarations in a call to a `__name` helper so `fn.name` survives minification
|
|
and bundling. The crash means the helper was missing or shadowed at the call
|
|
site for that module in the affected `tsx`/Node combination, so `__name(...)`
|
|
threw instead of returning the wrapped value.
|
|
|
|
## Current repro check
|
|
|
|
```bash
|
|
node --version
|
|
pnpm install
|
|
node --import tsx src/entry.ts status
|
|
```
|
|
|
|
Minimal isolated repro (loads only the module from the original stack trace):
|
|
|
|
```bash
|
|
node --import tsx scripts/repro/tsx-name-repro.ts
|
|
```
|
|
|
|
Both commands currently exit cleanly. If either throws `__name is not a
|
|
function` again, capture the exact Node version, `tsx` version
|
|
(`node_modules/tsx/package.json`), and full stack trace before filing upstream.
|
|
|
|
## Workarounds (if the crash returns)
|
|
|
|
- Run dev scripts with Bun instead of `node --import tsx`.
|
|
- Run `pnpm tsgo` for type checking, then run the built output instead of the
|
|
source through `tsx`:
|
|
|
|
```bash
|
|
pnpm tsgo
|
|
node openclaw.mjs status
|
|
```
|
|
|
|
- Try a different `tsx` version (`pnpm add -D tsx@<version>` is a dependency
|
|
change and needs approval per repo policy) to bisect whether the esbuild
|
|
version it bundles reintroduced the bug.
|
|
- Test on a different Node major/minor to see whether the failure is version
|
|
specific.
|
|
|
|
## References
|
|
|
|
- [https://esbuild.github.io/api/#keep-names](https://esbuild.github.io/api/#keep-names)
|
|
- [https://github.com/evanw/esbuild/issues/1031](https://github.com/evanw/esbuild/issues/1031)
|
|
|
|
## Related
|
|
|
|
- [Node.js install](/install/node)
|
|
- [Gateway troubleshooting](/gateway/troubleshooting)
|