[Bug] Anthropic API Error: Missing corresponding server_tool_use block for tool_result

Status Open
Reported on v2.1.241
Maintainer reply None cached
Activity 0 comments · opened Aug 24, 2026

Bug Description
API Error: 400 messages.5.content.0: unexpected tool_use_id found in advisor_tool_result blocks: srvtoolu_01T1ECmNJME23GpHFvV5U7rN. Each advisor_tool_result block must have a corresponding server_tool_use block before it.

Root cause, confirmed by timestamps: a Stop hook and a system-reminder fired mid-flight (19:30–19:31) while the advisor call was still running, and got spliced into the transcript between the server_tool_use and its advisor_tool_result (which only landed at 19:31:59). That splits one logical assistant turn into two, which the API rejects. This is a Claude Code harness race, not anything you did.

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.241
  • Feedback ID: 9c9d5e80-09c9-4015-bf7c-c885c77d692b

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01T1ECmNJME23GpHFvV5U7rN. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeNKYhyHewi9bLGo4cu43\"}\n    at generate (/$bunfs/root/cli:39:39492)\n    at makeRequest (/$bunfs/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-24T21:56:39.402Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01T1ECmNJME23GpHFvV5U7rN. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeNKgzCZps4rSU4s2MgaC\"}\n    at generate (/$bunfs/root/cli:39:39492)\n    at makeRequest (/$bunfs/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-24T21:58:31.783Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01T1ECmNJME23GpHFvV5U7rN. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeNL3nNzz71WqpxveXNbd\"}\n    at generate (/$bunfs/root/cli:39:39492)\n    at makeRequest (/$bunfs/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-24T22:03:13.894Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01T1ECmNJME23GpHFvV5U7rN. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeNL5mLJjVcmAfFYeWqTE\"}\n    at generate (/$bunfs/root/cli:39:39492)\n    at makeRequest (/$bunfs/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-24T22:03:40.747Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01T1ECmNJME23GpHFvV5U7rN. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeNL7e9Ww77e717h3nYj3\"}\n    at generate (/$bunfs/root/cli:39:39492)\n    at makeRequest (/$bunfs/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-24T22:04:06.248Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.5.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01T1ECmNJME23GpHFvV5U7rN. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeNLBj5nvuZYNwnFpwrrz\"}\n    at generate (/$bunfs/root/cli:39:39492)\n    at makeRequest (/$bunfs/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-24T22:05:01.586Z"}]

View original on GitHub ↗