[BUG] Terminal looping failure state when "`tool_use` ids were found without `tool_result`"
Environment
- Platform (select one): Claude Code
- Claude CLI version: 0.2.56
- Operating System: macOS 14.6
- Terminal: iTerm2
Bug Description
This has happened a few times in the past week, with different use cases. In this particular instance, Claude was using Bash() to call an AWS CLI command. It has an attempt count but it seems to either reset or be executing multiple failed tool uses in parallel. There's no way to interrupt this loop once it starts, outside of quitting Claude Code completely.
⏺ Found the <cognito> user pool. Let's check the user groups:
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 1 seconds… (attempt 1/10)
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 1 seconds… (attempt 1/10)
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 1 seconds… (attempt 1/10)
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 1 seconds… (attempt 2/10)
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 1 seconds… (attempt 2/10)
pause here
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.112: tool_use ids were found without tool_result blocks immediately after: toolu_01UgwHQyUfBzsFZjxNkaH2bf. Each tool_use
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 2 seconds… (attempt 3/10)
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 1 seconds… (attempt 1/10)
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 4 seconds… (attempt 4/10)
⎿ API Error ({"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"} }) · Retrying in 1 seconds… (attempt 2/10)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗