[Bug] Anthropic API Error: Invalid tool_use_id in advisor_tool_result after session compaction

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

Bug Description
Advisor fails with a 400 after a session drop / compaction. API Error: 400 messages.19.content.0: unexpected tool_use_id found in advisor_tool_result blocks: srvtoolu_01DsJKarSSnRwzk5xu1JGNoa. Each advisor_tool_result block must have a corresponding server_tool_use block before it. Repeats on every request once it starts. Turning the advisor off is the only way to keep working; turning it back on in the same session fails again. A fresh session is fine. The session had been through /compact and an MCP disconnect/reconnect before this appeared.

Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.238
  • Feedback ID: f52d29bb-6b10-417e-b4ce-b984ed61f542

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.19.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DsJKarSSnRwzk5xu1JGNoa. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeF3HEbwLrR4ou7Ffkpsf\"}\n    at generate (B:/~BUN/root/cli:39:39337)\n    at makeRequest (B:/~BUN/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-21T01:39:10.679Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.19.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DsJKarSSnRwzk5xu1JGNoa. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeF3JdiXJh2MfLg36YJTb\"}\n    at generate (B:/~BUN/root/cli:39:39337)\n    at makeRequest (B:/~BUN/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-21T01:39:29.884Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.19.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DsJKarSSnRwzk5xu1JGNoa. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeF3PoHNwENs58a6Uxx68\"}\n    at generate (B:/~BUN/root/cli:39:39337)\n    at makeRequest (B:/~BUN/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-21T01:40:39.738Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.19.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DsJKarSSnRwzk5xu1JGNoa. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeF3RHNbxseWWW42Qiuny\"}\n    at generate (B:/~BUN/root/cli:39:39337)\n    at makeRequest (B:/~BUN/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-21T01:40:59.852Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.19.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DsJKarSSnRwzk5xu1JGNoa. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeF3SfTR6d7GMM2remDhh\"}\n    at generate (B:/~BUN/root/cli:39:39337)\n    at makeRequest (B:/~BUN/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-21T01:41:18.566Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.19.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DsJKarSSnRwzk5xu1JGNoa. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CeF3TnTswRt1vYwQKkjkL\"}\n    at generate (B:/~BUN/root/cli:39:39337)\n    at makeRequest (B:/~BUN/root/cli:90:8063)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-08-21T01:41:33.839Z"}]

View original on GitHub ↗