anthropics / anthropics/claude-code

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

Open
#95,406 0 comments 0 reactions 0 assignees View on GitHub
area:core bug duplicate platform:macos
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

**Bug Description**
I stopped being able to interact with a session, with error "API Error: 400 messages.15.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DcAD2oDB6fdQXk4XdWShsW. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it."

**Environment Info**
- Platform: darwin
- Terminal: tmux
- Version: 2.1.276
- Feedback ID: 875ad5b9-85c7-4936-bd34-9ba6189b137b

**Errors**
```json
[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.15.content.0: unexpected `tool_use_id` found in `advisor_tool_result` blocks: srvtoolu_01DcAD2oDB6fdQXk4XdWShsW. Each `advisor_tool_result` block must have a corresponding `server_tool_use` block before it.\"},\"request_id\":\"req_011CfBH7dj3SKASZJr9C9Urs\"}\n at generate (/$bunfs/root/chunk-hd9xm3q1.js:11:14235)\n at makeRequest (/$bunfs/root/chunk-hd9xm3q1.js:51:8033)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-09-18T17:12:41.186Z"}]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the failure using Claude Code 2.1.276 on darwin in tmux, using feedback ID 875ad5b9-85c7-4936-bd34-9ba6189b137f as context. Trace how advisor_tool_result blocks are assembled before the Anthropic API request and compare them with the required server_tool_use blocks. Done means the reported session can continue without the 400 validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.