Repository navigation
[BUG] CLI crashes when rejecting permission-required tool use within Task tool #3958
Copy link
Copy link
Closed
Labels
area:corearea:toolsarea:tuibugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Description
Environment
- Platform (select one):
- Anthropic API
- AWS Bedrock
- Google Vertex AI
- Other:
- Claude CLI version: 1.0.56 (Claude Code)
- Operating System: macOS 14.3 (Darwin 24.3.0)
- Terminal:
Bug Description
Claude Code crashes with TypeError: Cannot read properties of undefined (reading 'message') when user rejects a permission-required tool use (such as Bash commands) within the Task tool via the interactive prompt.
Steps to Reproduce
- Start Claude Code with
claude - Enter "Please run rm no-exists-file in task tool"
- Task tool attempts to use Bash tool (which requires permission)
- When the tool use permission prompt appears, press 3 or choose "No, and tell Claude what to do differently (esc)"
- CLI crashes with TypeError
Expected Behavior
The CLI should gracefully handle the tool rejection and either:
- Show a message that the tool use was rejected
- Ask for alternative instructions
- Continue the conversation without crashing
Actual Behavior
The CLI crashes with the following error:
TypeError: Cannot read properties of undefined (reading 'message')
at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:798
at Array.filter (<anonymous>)
at Object.renderToolUseProgressMessage (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:763)
at Object.renderToolUseRejectedMessage (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:2307)
at wHB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2334:1247)
at aq (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:19804)
at Fy (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:42569)
at Gy (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38118)
at IO (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38046)
at VN (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:37900)
ERROR Cannot read properties of undefined (reading 'message')
file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:798
- (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:798)
- at Array.filter (<anonymous>)
- Object.renderToolUseProgressMessage (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:763)
- Object.renderToolUseRejectedMessage (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2415:2307)
- wHB (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2334:1247)
- aq (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:19804)
- Fy (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:42569)
- Gy (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38118)
- IO (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38046)
- VN (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:37900)
Additional Context
The error appears to be in the renderToolUseRejectedMessage function when trying to access the message property of an undefined object during array filtering. This suggests there's a null/undefined handling issue in the tool rejection flow.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:corearea:toolsarea:tuibugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSIssue specifically occurs on macOS
Activity
takahirom commentedon Jul 24, 2025
This seems to occur only when using Claude hooks. The only hook I'm using is the following:
{ "model": "sonnet", "hooks": { "PreToolUse": [ { "matcher": "", "hooks": [ { "type": "command", "command": "jq '.' >> /tmp/claude_hooks.jsonl" } ] } ] } }takahirom commentedon Aug 3, 2025
I think this has been fixed. If you have the same problem. Let me know.
github-actions commentedon Aug 11, 2025
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.