Infinite API error loops forces claude code to restart and context loss
Platform (select one):
Claude CLI version: 1.0.24 (Claude Code)
Operating System: macOS 10.15.7 (Catalina)
Terminal: bash
Bug Description:
Claude Code gets stuck in infinite API error loops when validation errors occur, preventing recovery and requiring CLI restart with complete context loss.
Steps to Reproduce:
Trigger an API validation error (upload image >5MB or create orphaned tool_use block)
Observe the same API 400 error repeating infinitely
Try typing new commands - they are ignored or trigger the same error
Must exit and restart Claude Code
Expected Behavior:
Display clear error message explaining the validation issue
Provide recovery options or gracefully return to prompt
Allow user to continue session after addressing the error
Actual Behavior:
Same API 400 error repeats in infinite loop:
tool_use ids were found without tool_result blocks immediately after: toolu_01BrbQYKJyyV8f2fudUGdcGM
image exceeds 5 MB maximum: 8540840 bytes > 5242880 bytes
CLI becomes completely unresponsive to new input
Forces session termination and restart
All conversation context and history is lost
Additional Context:
This affects workflow continuity significantly since common validation errors (large images, interrupted tool execution) require full session restart. The error handling should detect validation failures and prevent infinite retry loops.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗