[Bug] Failed to parse command: Bad substitution in rule.else_text

Resolved 💬 3 comments Opened Jan 15, 2026 by dnickerson Closed Jan 19, 2026

Bug Description
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Failed to parse command: Bad substitution: rule.else_text
at ZfA (file:///home/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:4378:117)
at FK (file:///home/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:4381:192)
at JV1 (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:4381:1712)
at Object.isReadOnly (file:///home//.npm-global/lib/node_module

Environment Info

  • Platform: linux
  • Terminal: WezTerm
  • Version: 2.1.7
  • Feedback ID: d4a0c47b-ac10-4c3c-b00d-3f97ade7cac3

Errors

[{"error":"AxiosError: Request failed with status code 401\n    at cy (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:55:1138)\n    at IncomingMessage.<anonymous> (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:56:9867)\n    at IncomingMessage.emit (node:events:536:35)\n    at IncomingMessage.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1698:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n    at cUA.request (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:58:2132)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async EV7 (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3532:23931)\n    at async file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3532:24849","timestamp":"2026-01-15T15:27:58.551Z"},{"error":"MaxFileReadTokenExceededError: File content (34970 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n    at w12 (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1667:13298)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.call (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1676:996)\n    at async file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2956:1513","timestamp":"2026-01-15T15:29:17.140Z"},{"error":"MaxFileReadTokenExceededError: File content (34970 tokens) exceeds maximum allowed tokens (25000). Please use offset and limit parameters to read specific portions of the file, or use the GrepTool to search for specific content.\n    at w12 (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1667:13298)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Object.call (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1676:996)\n    at async file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:2956:1513","timestamp":"2026-01-15T15:29:19.211Z"},{"error":"Error: Request was aborted.\n    at OBA._createMessage (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:495:3157)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2026-01-15T15:48:40.846Z"},{"error":"Error: Request was aborted.\n    at OBA._createMessage (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:495:3157)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2026-01-15T16:00:49.597Z"},{"error":"Error: Request was aborted.\n    at OBA._createMessage (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:495:3157)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at runNextTicks (node:internal/process/task_queues:64:3)\n    at process.processTimers (node:internal/timers:516:9)","timestamp":"2026-01-15T16:03:31.663Z"},{"error":"SyntaxError: Unexpected non-whitespace character after JSON at position 60\n    at JSON.parse (<anonymous>)\n    at file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:74:672\n    at B (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:8:6815)\n    at rA2 (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1657:3135)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2026-01-15T16:27:53.987Z"},{"error":"Error: Bad substitution: rule.else_text\n    at E (file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:74:2523)\n    at file:///home//.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:74:3178\n    at Array.map (

Note: Error logs were truncated.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗