Bad Substitution Error in Claude CLI String Manipulation

Resolved 💬 3 comments Opened Jul 2, 2025 by prodepollo Closed Aug 20, 2025

Bug Description
Claude crashed with the error below. This happened while Claude Code was trying to create a new Issue on GitHub. The bug was reported on a new Claude Code session as that one had crashed completely and brought me back to bash.

Error: Bad substitution: name.replace
at H (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:7:2204)
at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:7:2863
at Array.map (<anonymous>)
at vi2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:7:1942)
at Object.A (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:7:3027)
at i1A (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1512:3494)
at cy (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1518:77)
at Object.isReadOnly (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1590:3316)
at Object.isConcurrencySafe (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1590:3232)
at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1931:7162

Node.js v23.11.0

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 1.0.40
  • Feedback ID: dd4d6a7e-893b-4b43-a7d9-30701d8f6fba

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at FI (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:702:3921)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:9038\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:13327)\n    at _X (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:8184)\n    at H_ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:7265)\n    at U9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:623:11432)","timestamp":"2025-07-02T12:33:51.230Z"}]

View original on GitHub ↗

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