Bug: Duplicate tool_use IDs when Claude uses parallel tool calls

Resolved 💬 6 comments Opened Jan 26, 2026 by DragonShadows1978 Closed Mar 24, 2026

Claude CLI Bug Report: Duplicate tool_use IDs
=============================================
Date: 2026-01-26
Claude CLI Version: 2.1.19
Affected: AtlasForge autonomous missions

SUMMARY
-------
The Claude CLI is generating duplicate tool_use IDs when Claude responds with
parallel tool calls. This causes API rejection with error 400.

ERROR MESSAGE
-------------
API Error: 400 {
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "messages.1.content.1: tool_use ids must be unique"
},
"request_id": "req_011CXWhwu3ynGQyJoeTQ3ua8"
}

SYMPTOMS
--------

  1. AtlasForge conductor log shows empty "Claude error:" messages
  2. Retries 3 times, then halts with "Claude unresponsive"
  3. Actual error only visible in .claude/projects/*/session.jsonl
  4. Affects both modular and legacy AtlasForge engines
  5. Happens during PLANNING stage when Claude attempts parallel tool calls

ROOT CAUSE
----------
When Claude responds with multiple tool_use blocks in a single message (parallel
tool calls), the CLI appears to log them as separate entries with the same msg_id
and requestId. When these get replayed or sent to the API, the duplicate IDs
cause rejection.

Evidence from jsonl:

  • Two assistant entries with identical msg_id (msg_01UtkrFdBQeb4RmWtwrroC41)
  • Same requestId (req_011CXWhP5HxKWQgm9EJ6mg3a)
  • This violates API requirement that tool_use ids must be unique

NOT CAUSED BY ATLASFORGE PROMPT CONSTRUCTION
---------------------------------------------
AtlasForge invocation is clean and simple (from atlasforge_conductor.py:223-231):

result = subprocess.run(
["claude", "-p", "--dangerously-skip-permissions"],
input=prompt,
capture_output=True,
text=True,
timeout=timeout,
cwd=str(cwd),
start_new_session=True
)

  • "claude -p" = Print mode (non-interactive)
  • "--dangerously-skip-permissions" = Skip permission prompts
  • Prompt sent via stdin as plain text
  • No tool instructions in the prompt itself

The prompt is just text containing mission instructions. AtlasForge does NOT:

  • Specify which tools to use
  • Request parallel execution
  • Control tool_use ID generation

The parallel tool_use is Claude's OWN DECISION when processing the prompt.
Claude sees "explore the codebase" and decides to call Read/Glob/Grep in parallel.
The CLI then generates duplicate IDs for these parallel calls - that's the bug.

Chain of events:

  1. AtlasForge sends plain text prompt via stdin
  2. Claude decides to use multiple tools in parallel (its own choice)
  3. Claude CLI generates tool_use blocks with duplicate IDs (BUG)
  4. API rejects: "tool_use ids must be unique"

This is 100% a Claude CLI bug, not an AtlasForge issue.

REPRODUCTION
------------
Original observation (AtlasForge):

  1. Run AtlasForge in R&D mode with a mission that triggers exploration
  2. Claude attempts parallel Read/Glob/Grep calls during PLANNING
  3. CLI logs parallel tool calls incorrectly
  4. API rejects with "tool_use ids must be unique"
  5. Mission halts after 3 retries

Minimal reproduction (confirmed 2026-01-26):

echo "Read these 3 files in parallel and tell me the first line of each: /home/vader/AI-AtlasForge/atlasforge_conductor.py, /home/vader/AI-AtlasForge/af_engine.py, /home/vader/AI-AtlasForge/GROUND_RULES.md" | claude -p --dangerously-skip-permissions

Result:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.3: `tool_use` ids must be unique"},"request_id":"req_011CXWif4yfcL2D7xb3ogquJ"}

Key finding: Bug occurs in print mode (-p) but NOT in interactive mode.
Same parallel tool calls work fine in interactive Claude session.

AFFECTED FILES
--------------
Conductor log: /home/vader/AI-AtlasForge/logs/atlasforge_conductor.log
Session jsonl: /home/vader/.claude/projects/-home-vader-AI-AtlasForge-workspace-*/

WORKAROUNDS ATTEMPTED
---------------------

  1. USE_MODULAR_ENGINE=false (legacy engine) - Same error
  2. Multiple retries - Fails consistently

POTENTIAL FIXES
---------------

  1. Anthropic fixes CLI to generate unique IDs for parallel tool calls
  2. CLI version downgrade (untested)
  3. Disable parallel tool calls in Claude prompts (limits functionality)

IMPACT
------

  • AtlasForge autonomous missions cannot proceed
  • Any workflow triggering parallel tool_use is affected
  • Mission halts during PLANNING stage before any work begins

RECOMMENDATION
--------------
Report to: https://github.com/anthropics/claude-code/issues
Include: This report + sample jsonl showing duplicate IDs

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗