Claude API Error: tool_use ids were found without tool_result blocks (Fixed)

November 18, 2026 · Claude API, Field by Field (part 3)

▶ Watch on YouTube & subscribe to The Stack Underflow

Claude asked for two tools at once, my program answered one, and the API sent back a 400 (the real id hidden):

messages.2: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_REDACTED_2. Each `tool_use` block must have a corresponding `tool_result` block in the next message.

The one-line version: answer every tool call, all in the very next user message, tool results first.

Tested: 16-17 November 2026 (claude-sonnet-5-5; Python SDK anthropic 2.8.0; effort low; one tool get_weather(city) over a fake two-city table; in Docker). Newer versions may behave differently.

The words first

  • tool_use block: Claude’s request to run one of your tools, with an id.
  • tool_result block: your answer to one request, quoting its id as tool_use_id.
  • Parallel tool use: several tool_use blocks in one reply. It is on by default.

What the runs showed

  • First call, 9 runs: stop_reason tool_use, two tool calls in one reply. Paris came first in all 9 here; don’t count on the order. 385 input and 99 output tokens, 0.18 cents.
  • The bug, one tool result for the first call only: 400 invalid_request_error naming the skipped ID (call 2, Tokyo). A second run failed the same way. No token usage came back.
  • A line of text first, then both results: the same 400 message, now naming both IDs.
  • Two separate user messages, one result each: accepted (end_turn), same tokens (556 in, 42 out) and same answer as the fix, because the API combines back-to-back messages into one turn. The docs still mark it wrong: it reduces parallel tool calls.
  • The fix, every tool result in one message, results first: end_turn, “Paris 14 °C and cloudy, Tokyo 9 °C and clear”. 0.33 cents per question (0.18 for the first call, 0.15 for the answer).
  • A tool that fails (Paris and Atlantis): still one tool result per ID; Atlantis’s carries the error text and is_error set to true. Claude said it couldn’t get a result for Atlantis and quoted the error text.

The fix

Python, condensed from the lab; content is Claude’s reply as a list of dicts:

def answer(call):
    text, failed = get_weather(call['input']['city'])
    result = {'type': 'tool_result', 'tool_use_id': call['id'], 'content': text}
    if failed:
        result['is_error'] = True
    return result

def answer_every_id(content):
    results = []
    for block in content:
        if block['type'] == 'tool_use':
            results.append(answer(block))
    return results

messages.append({'role': 'assistant', 'content': content})
messages.append({'role': 'user', 'content': answer_every_id(content)})

When you see this 400, check:

  1. Every tool call got a tool result?
  2. All in the very next message?
  3. Results before any text?

Or let the Python SDK’s tool runner (client.beta.messages.tool_runner, beta as of 16 Nov 2026) send the results for you.

What it cost

List price, 16 Nov 2026 (Sonnet 5.5: input $2, output $10 per million tokens). The whole lab: $0.0226 (13 billed calls; the 400s returned no usage).

Your turn

Claude asks for Paris and for Atlantis, and your table has no Atlantis. What do you send back? Reply in the video’s pinned comment.

The series

Sources

Read 16 November 2026:

Change notes

  • 20 Nov 2026: first published, from the lab results of 16-17 Nov 2026.

Not affiliated with or endorsed by Anthropic. Found a mistake? Tell us in the video’s comments and we’ll correct this page.

Found this useful? The deep version lives on YouTube — new breakdowns of how AI dev tools actually work, weekly.

Subscribe on YouTube →

Prefer email? Get the free newsletter: one failure, traced step by step, about once a week.