claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Tool-usage with large parameters can cause indefinite retry loops

Open ShitizZip opened this issue 6 months ago • 0 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [x] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: 1.0.35
  • Operating System: macOS 15.5
  • Terminal: Terminal App

Bug Description

Claude models cannot stream tool arguments, and as a result have to process the entire tool response before sending it as an output. This means that when writing large files or compact summaries, it can just cause an indefinite timeout loop because it just needs more time to process through a certain number of tokens.

I am using the following prompt as a workaround in my CLAUDE.md file, but just having a configurable timeout is a great workaround for this

<generalToolUse>
- When using any tools (file editing, MCP etc), always perform SMALL OPERATIONS and prefer multiple operations over one large operation.
- SMALL OPERATIONS means you do not create, or find and replace more than 50 lines, or have arguments for tool uses that are more than 50 lines. 
- BOTH `find` and `replace` (or `old` and `new`) parts of the operation MUST ADHERE to this limit.
- All parameters that are a part of the tool invocation MUST ADHERE to this limit
</generalToolUse>

Steps to Reproduce

As you start using tools with larger and larger parameters you will see a longer latency and response time, eventually leading to timeout. Just asking it to write really long files or summaries will be a fairly consistent way of reproducing this issues.

Expected Behavior

API shouldn't timeout on larger operations.

Actual Behavior

API times out.

Additional Context

Happens on Bedrock, haven't tried with other providers.

ShitizZip avatar Jun 27 '25 04:06 ShitizZip