API Error: tool_use ids must be unique after tool execution
Resolved 💬 3 comments Opened Jan 26, 2026 by djclarkson Closed Jan 29, 2026
Bug Description
Claude Code CLI fails with API error after any tool execution completes. The tool action succeeds but the response handling fails.
Error Message
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.1: `tool_use` ids must be unique"}}
Environment
- Claude Code Version: 2.1.19
- OS: Ubuntu 24.04 (Vultr VM)
- Installation:
curl -fsSL https://claude.ai/install.sh | sh
Steps to Reproduce
- Fresh VM with clean
~/.claudedirectory - Run any prompt that triggers tool use:
``bash``
cd /tmp && mkdir test && cd test
~/.local/bin/claude --dangerously-skip-permissions -p "Create a file called hello.txt containing Hello World"
- Error occurs on the response after tool execution
Observed Behavior
- First API call succeeds (Claude decides to create file)
- Tool executes successfully (file IS created with correct content)
- Second API call fails with "tool_use ids must be unique" error
- Conversation breaks
Expected Behavior
Tool execution should complete and Claude should respond with confirmation.
Verification
- File
hello.txtexists after error (6 bytes, correct content) - Simple prompts WITHOUT tools work fine:
claude -p "Say hello"→ succeeds - Issue persists after:
- Killing all claude processes
- Deleting ~/.claude directory completely
- Reinstalling Claude CLI
- VM restart
Additional Context
This appears to be the CLI generating duplicate tool_use IDs when constructing the message payload for the second API call after tool execution completes.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗