[Bug] Anthropic API Error: 400 - Tool Use Concurrency Issues

Resolved 💬 18 comments Opened Nov 11, 2025 by corneliusroemer Closed Mar 1, 2026

Bug Description
Claude Code is stuck while running 3 tools in parallel:


 ▐▛███▜▌   Claude Code v2.0.37
▝▜█████▛▘  Sonnet 4.5 · Claude Pro
  ▘▘ ▝▝    /Users/cr/code/loculus/website/codemods

> fix the wrongly pointed CLAUDE.md symlink to point at the AGENTS.md in this file

⏺ I'll fix the symlink to point to the correct AGENTS.md file.

  Let me first check the current state of the symlink and find the AGENTS.md file:

> you got stuck?
  ⎿  API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation.

> /feedback
  ⎿  Feedback / bug report submitted

⏺ Bash(ls -la CLAUDE.md)
  ⎿  Running…

⏺ Bash(ls -la AGENTS.md)
  ⎿  Running…

⏺ Bash(pwd)
  ⎿  Running…

Reproduction

I have a CLAUDE.md that's pointed at a non-existing file (this was user error). However, that shouldn't get CLAUDE to get hung up.

  1. touch AGENTS.md
  2. ln -s doesntexit CLAUDE.md
  3. claude 'fix the wrongly pointed CLAUDE.md symlink to point at the AGENTS.md in this file'

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.0.37
  • Feedback ID: 276b774c-faf7-4085-ac28-39c66adba63a

Errors

[{"error":"Error: Lock file is already being held\n    at <anonymous> (/$bunfs/root/claude:87:11857)\n    at X (/$bunfs/root/claude:86:5167)\n    at <anonymous> (node:fs:243:13)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-11T14:28:37.885Z"},{"error":"Error\n    at Kw (/$bunfs/root/claude:59:1142)\n    at <anonymous> (/$bunfs/root/claude:64:10074)\n    at emit (node:events:92:22)\n    at endReadableNT (internal:streams/readable:861:50)\n    at processTicksAndRejections (native:7:39)\n    at request (/$bunfs/root/claude:66:2146)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-11T14:28:38.264Z"},{"error":"Error: Lock file is already being held\n    at <anonymous> (/$bunfs/root/claude:87:11857)\n    at X (/$bunfs/root/claude:86:5167)\n    at <anonymous> (node:fs:243:13)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-11T14:28:45.413Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.2: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01KmABc9NCMy5RJysowsbePy, toolu_01PKM3nuBfZ7Z3GS4mzWqqSn, toolu_01QupRKTCoJLbtgprX6aaZbn. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CV2G8EEr6qV6sHbwhw4hy\"}\n    at generate (/$bunfs/root/claude:228:83080)\n    at makeRequest (/$bunfs/root/claude:670:5356)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-11T14:29:45.354Z"},{"error":"Error: Lock file is already being held\n    at <anonymous> (/$bunfs/root/claude:87:11857)\n    at X (/$bunfs/root/claude:86:5167)\n    at <anonymous> (node:fs:243:13)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-11T14:29:48.176Z"},{"error":"Error: Lock file is already being held\n    at <anonymous> (/$bunfs/root/claude:87:11857)\n    at X (/$bunfs/root/claude:86:5167)\n    at <anonymous> (node:fs:243:13)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-11-11T14:30:01.588Z"}]

View original on GitHub ↗

18 Comments

github-actions[bot] · 8 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/9324
  2. https://github.com/anthropics/claude-code/issues/11241
  3. https://github.com/anthropics/claude-code/issues/8187

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

andy-rootly · 7 months ago
github-actions[bot] · 6 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

esakkiraja-skillrank · 6 months ago

<img width="1439" height="485" alt="Image" src="https://github.com/user-attachments/assets/ed2cd883-2102-4d86-80f1-93e973bcf7fd" />

youngpake · 5 months ago

Same problem here

youngpake · 5 months ago

It makes claude code unusable, it takes 10 prompts to just get one action done if you're lucky

MiccoHadje · 5 months ago

It's terrible. How do we get this escalated?

youngpake · 5 months ago

Maybe try making a post on reddit about it, sometimes helps

Sudospective · 5 months ago
Error: Lock file is already being held

this error from ops post looks very familiar to me dealing with debians apt...did anyone here recently suffer a bad crash while using claude code?

PHY041 · 5 months ago

✅ WORKAROUND FOUND

The fix: Install VS Code extension version 2.1.17 while keeping CLI at 2.1.19

Steps:

  1. In VS Code, go to Extensions
  2. Find "Claude Code for VS Code"
  3. Click the dropdown arrow next to Uninstall → "Install Specific Version" → Select 2.1.17
  4. Uncheck "Auto Update" to prevent it from upgrading
  5. Restart VS Code

Result:

  • Extension shows: 2.1.17
  • claude --version shows: 2.1.19
  • It works! No more concurrency errors

What this tells us:
The bug is in the VS Code extension code (2.1.18 or 2.1.19), NOT in the CLI or API. The extension's tool call orchestration is broken in newer versions.

| Configuration | Status |
|---------------|--------|
| Extension 2.1.19 + CLI 2.1.19 | ❌ Broken |
| Extension 2.1.17 + CLI 2.1.19 | ✅ Works |

Hope this helps others!

NTShop · 5 months ago

Confirmed that this workaround works for me - downgraded to extension v2.1.17 fixed it, I'm using claude v2.0.22.

matthew-omada-ai · 5 months ago

Confirming that downgrading to 2.1.17 also worked for me. Thank you!

djosh34 · 5 months ago

Yes downgrading resolved the issue.
Issue only happens for me after some time, when using claude in cli mode claude -p "some prompt"

Downgrading solved it for me:
curl -fsSL https://claude.ai/install.sh | bash -s v2.1.17

(or without v, i forgot)

Don't forget disabling auto update, and removing the existing like you can find with whereis claude

(otherwise the new version will still be used)

konard · 5 months ago

Additional Case Report: Parallel Edit Tool Calls to Same File

I encountered this same error in an automated AI solver workflow. Adding this case as it provides additional detail about a specific trigger scenario.

Environment

  • Claude Code: Running via programmatic CLI (claude --output-format stream-json -p ...)
  • Model: claude-sonnet-4-5-20250929
  • Platform: Linux (Ubuntu)
  • Date: 2026-01-27

Specific Trigger: Parallel Edit Tool Calls on Same File

In my case, Claude attempted 4 parallel Edit tool calls to the same file (src/algorithms/max_first_reduction.rs) within a single streamed message:

  1. First Edit succeeded and modified the file
  2. Subsequent Edits failed with "String to replace not found in file" (because the file had already been modified)
  3. The combination of partial success/failure corrupted the tool_use/tool_result pairing
  4. API returned: "tool_use" ids were found without "tool_result" blocks immediately after

Error Details from Logs

{
  "type": "error",
  "error": {
    "type": "invalid_request_error", 
    "message": "`tool_use` ids were found without `tool_result` blocks immediately after: toolu_01KmABc9NCMy5RJysowsbePy, toolu_01PKM3nuBfZ7Z3GS4mzWqqSn, toolu_01QupRKTCoJLbtgprX6aaZbn. Each `tool_use` block must have a corresponding `tool_result` block in the next message."
  }
}

Suggested Mitigation

For the Edit tool specifically, parallel calls to the same file should be serialized because:

  • Each Edit modifies the file content
  • Subsequent Edits reference old_string that may no longer exist after prior modifications
  • This creates a race condition even when the API itself handles parallel tools correctly

Workaround

For now, I've worked around this by adding prompt guidance:

When making multiple Edit tool calls to the same file, execute them SEQUENTIALLY (not in parallel).

However, a client-side fix in Claude Code to automatically serialize same-file Edit operations would be more robust.

Full Case Study

I've documented this case in detail: https://github.com/link-assistant/hive-mind/issues/1188

philbourg · 5 months ago

Got the problem since yesterday on each prompt, both on Windows and WSL.
I tried updating to 2.1.20 this morning, still not working, got the error on each prompt.
Confirming that downgrading to 2.1.17 also worked for me.

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.