[BUG] Tool result tracking error after session interruption causing repeated API 400 failures

Resolved 💬 2 comments Opened Oct 11, 2025 by klueless-io Closed Oct 11, 2025

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?

Claude Code is failing with repeated API 400 errors indicating
missing tool results:

API Error: 400 {"type":"error","error":{"type":"invalid_request_e
rror","message":"messages.37: tool_use ids were found without
tool_result blocks immediately after:
toolu_019hT8NaQcNRyZhDyPX7LwNz. Each tool_use block must have a
corresponding tool_result block in the next message."}}

What Should Happen?

  • Session resumption should maintain proper tool use/result

pairing in message history

  • Tool use blocks should always have corresponding tool result

blocks in the message history sent to the API

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_e
  rror","message":"messages.37: `tool_use` ids were found without
  `tool_result` blocks immediately after:
  toolu_019hT8NaQcNRyZhDyPX7LwNz. Each `tool_use` block must have a
   corresponding `tool_result` block in the next message."}}

Steps to Reproduce

  1. Start a long-running conversation with multiple tool uses
  2. Stop the session (interrupt/close)
  3. Resume/restart the session
  4. Ask Claude to perform any task (in this case, comparing two

files using @ mentions)

  1. API error occurs and conversation becomes stuck
  2. Every subsequent message triggers the same error

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.1

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Expected Behavior

  • Session resumption should maintain proper tool use/result

pairing in message history

  • Tool use blocks should always have corresponding tool result

blocks in the message history sent to the API

Actual Behavior

After stopping and restarting a long-running conversation:

  • Tool use ID toolu_019hT8NaQcNRyZhDyPX7LwNz is missing its

result block at message 37

  • All subsequent API calls fail with the same error
  • Conversation becomes completely unusable

View original on GitHub ↗

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