Diagnostics
Node + tsx क्रैश
Node + tsx "__name is not a function" क्रैश
सारांश
tsx के साथ Node के जरिए OpenClaw चलाने पर startup में यह विफल होता है:
[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यह dev scripts को Bun से tsx पर स्विच करने के बाद शुरू हुआ (commit 2871657e, 2026-01-06)। वही runtime path Bun के साथ काम करता था।
Environment
- Node: v25.x (v25.3.0 पर देखा गया)
- tsx: 4.21.0
- OS: macOS (repro संभवतः Node 25 चलाने वाले अन्य platforms पर भी)
Repro (केवल Node)
# in repo rootnode --versionpnpm installnode --import tsx src/entry.ts statusrepo में न्यूनतम repro
node --import tsx scripts/repro/tsx-name-repro.tsNode version check
- Node 25.3.0: विफल
- Node 22.22.0 (Homebrew
node@22): विफल - Node 24: अभी यहां installed नहीं है; verification चाहिए
Notes / hypothesis
tsx, TS/ESM को transform करने के लिए esbuild का उपयोग करता है। esbuild काkeepNamesएक__namehelper emit करता है और function definitions को__name(...)से wrap करता है।- क्रैश दिखाता है कि runtime पर
__nameमौजूद है लेकिन function नहीं है, जिसका अर्थ है कि इस module के लिए Node 25 loader path में helper missing या overwritten है। - इसी तरह की
__namehelper समस्याएं अन्य esbuild consumers में report हुई हैं, जब helper missing या rewritten होता है।
Regression history
2871657e(2026-01-06): Bun को optional बनाने के लिए scripts को Bun से tsx में बदला गया।- उससे पहले (Bun path),
openclaw statusऔरgateway:watchकाम करते थे।
Workarounds
-
dev scripts के लिए Bun का उपयोग करें (मौजूदा temporary revert)।
-
repo type checking के लिए
tsgoका उपयोग करें, फिर built output चलाएं:bash pnpm tsgonode openclaw.mjs status -
ऐतिहासिक नोट: इस Node/tsx issue को debug करते समय यहां
tscइस्तेमाल किया गया था, लेकिन repo type-check lanes अबtsgoका उपयोग करते हैं। -
संभव हो तो TS loader में esbuild keepNames disable करें (
__namehelper insertion रोकता है); tsx वर्तमान में इसे expose नहीं करता। -
यह देखने के लिए Node LTS (22/24) को
tsxके साथ test करें कि issue Node 25-specific है या नहीं।
References
- https://opennext.js.org/cloudflare/howtos/keep_names
- https://esbuild.github.io/api/#keep-names
- https://github.com/evanw/esbuild/issues/1031
Next steps
- Node 25 regression की पुष्टि करने के लिए Node 22/24 पर repro करें।
- यदि कोई known regression मौजूद है, तो
tsxnightly test करें या earlier version पर pin करें। - यदि Node LTS पर reproduce होता है, तो
__namestack trace के साथ upstream में minimal repro file करें।
Related
Was this useful?