[BUG] API Error 400 - tool_use without tool_result race condition in VS Code extension

Resolved 💬 3 comments Opened Jan 25, 2026 by MiCredDev Closed Jan 29, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Every tool use operation fails with a 400 error due to tool_use/tool_result mismatch, even in fresh conversations.
Error message:
messages.1: tool_use ids were found without tool_result blocks immediately after: toolu_XXXXX. Each tool_use block must have a corresponding tool_result block in the next message.

Observations:

Tools execute successfully (output is visible)
Error occurs on the follow-up API call
Happens consistently, not intermittently
Persists after clearing all session data, reinstalling extension
Multiple Claude processes spawn simultaneously (visible in logs)
Extension logs show SessionEnd events firing mid-conversation

Workarounds attempted (none worked):

Clearing ~/.claude directory
Disabling MCP servers
Fresh VS Code install
New conversations

What Should Happen?

it should work

Error Messages/Logs

Steps to Reproduce

Open a project in VS Code with Claude Code extension
Start a new conversation
Request any file read operation
Error occurs after tool executes but before response completes

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Code 2.1.19 (VS Code extension)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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