Files
bot/docs/debug/node-issue.md
zeekay acaeda400a Eradicate OpenClaw — resolve merge conflicts and finish the rebrand
Three coordinated things:

1. Resolve the committed upstream/main merge conflicts. 94 files were
   sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
   conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
   by keeping HEAD everywhere — 540 conflict blocks.

2. Rewrite remaining OpenClaw text refs.
     OPENCLAW   → HANZO_BOT
     OpenClaw   → HanzoBot          (PascalCase type identifiers)
     openclaw   → bot               (codebase convention — botToken,
                                    botUsername etc.; avoids invalid
                                    hyphenated JS identifiers)
     openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z]   (compound)
     ai.openclaw.x → ai.hanzo.bot.x  (JVM package path)

3. Delete or rename openclaw-named file paths (116 of them). Dead
   duplicates with a Bot-named canonical from the partial migration:
   deleted. Otherwise renamed.
     ai/openclaw/**           → deleted (ai/hanzo/bot/** canonical)
     Sources/OpenClaw*/       → deleted (Sources/Bot* canonical)
     Tests/OpenClawIPCTests/  → deleted (Tests/BotIPCTests canonical)
     OpenClawKit/             → deleted (BotKit canonical)
     openclaw-tools.*.ts      → deleted (bot-tools.*.ts canonical)
     openclaw-root.ts etc.    → deleted (bot-root.ts canonical)
     types.openclaw.ts        → deleted (types.bot.ts canonical)
     extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
     docs/start/openclaw.md   → renamed hanzo-bot.md (+ zh-CN)
     docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
     scripts/.../openclaw-*   → deleted (bot/hanzo-bot parallels)
     openclaw.mjs             → deleted (hanzo-bot.mjs is package.bin)

Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).

Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.

The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.

Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
2026-05-11 17:56:29 -07:00

2.8 KiB
Raw Permalink Blame History

summary, read_when, title
summary read_when title
Node + tsx "__name is not a function" crash notes and workarounds
Debugging Node-only dev scripts or watch mode failures
Investigating tsx/esbuild loader crashes in HanzoBot
Node + tsx Crash

Node + tsx "__name is not a function" crash

Summary

Running HanzoBot via Node with tsx fails at startup with:

[hanzo-bot] 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.

Environment

  • Node: v25.x (observed on v25.3.0)
  • tsx: 4.21.0
  • OS: macOS (repro also likely on other platforms that run Node 25)

Repro (Node-only)

# in repo root
node --version
pnpm install
node --import tsx src/entry.ts status

Minimal repro in repo

node --import tsx scripts/repro/tsx-name-repro.ts

Node version check

  • Node 25.3.0: fails
  • Node 22.22.0 (Homebrew node@22): fails
  • Node 24: not installed here yet; needs verification

Notes / hypothesis

  • tsx uses esbuild to transform TS/ESM. esbuild’s keepNames emits a __name helper and wraps function definitions with __name(...).
  • The crash indicates __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.
  • Similar __name helper issues have been reported in other esbuild consumers when the helper is missing or rewritten.

Regression history

  • 2871657e (2026-01-06): scripts changed from Bun to tsx to make Bun optional.
  • Before that (Bun path), hanzo-bot status and gateway:watch worked.

Workarounds

  • Use Bun for dev scripts (current temporary revert).

  • Use Node + tsc watch, then run compiled output:

    pnpm exec tsc --watch --preserveWatchOutput
    node --watch hanzo-bot.mjs status
    
  • Confirmed locally: pnpm exec tsc -p tsconfig.json + node hanzo-bot.mjs status works on Node 25.

  • 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.

References

Next steps

  • Repro on Node 22/24 to confirm Node 25 regression.
  • Test tsx nightly or pin to earlier version if a known regression exists.
  • If reproduces on Node LTS, file a minimal repro upstream with the __name stack trace.