[BUG] Error: Bad substitution: [function name]
Resolved 💬 3 comments Opened Jul 3, 2025 by shanev Closed Jan 8, 2026
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.41 (Claude Code)
- Operating System: macOS 15.5 (24F74)
- Terminal: Ghostty 1.1.3
Bug Description
Claude consistently throws an error because it tries to create a script in /tmp which it does not have access to.
Steps to Reproduce
- Ask it to debug an issue that requires writing a script
Expected Behavior
Claude creates the script in the local directory which it has access to.
Actual Behavior
Claude tried to create the script in /tmp and crashed, with the bad substitution error.
Additional Context
You can work around this by explicitly asking Claude to create debug scripts in the local directory.
Trace:
Error: Bad substitution: [function name]
at H (file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:7:2204)
at file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:7:2863
at Array.map (<anonymous>)
at vi2 (file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:7:1942)
at Object.A (file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:7:3027)
at i1A (file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1512:3494)
at iy (file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1518:77)
at Object.isReadOnly (file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1590:3316)
at Object.isConcurrencySafe (file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1590:3232)
at file:///Users/blockshane/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1931:7014
Node.js v22.16.0This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗