Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

handling-stop-reasons changedbuild-with-claude/handling-stop-reasons

Nearest release: v2.1.330, published under an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+16added
Lines−16removed
From line 10 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits32to this page, all time

The whole hunk

from line 10, old and new numbered
/
lines
from line 10
1010 
1111## Quick reference
1212 
13| Value | When it occurs | What to do |
14| -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
15| [`end_turn`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#end-turn) | Claude completed its response naturally. | Use the response. |
16| [`max_tokens`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#max-tokens) | The response reached your `max_tokens` limit. | Raise `max_tokens` or [continue the response](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#ensuring-complete-responses). |
17| [`stop_sequence`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#stop-sequence) | Claude emitted one of your `stop_sequences`. | Read `stop_sequence` to see which one fired. |
18| [`tool_use`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#tool-use) | Claude is calling a tool. | Run the tool and return the result. A server tool call still missing its result block completes in a later response. |
19| [`pause_turn`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#pause-turn) | A server-tool loop reached its iteration limit. | Send the assistant content back to continue. |
20| [`refusal`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#refusal) | Claude declined to respond. | Read `stop_details` and [retry on a fallback model](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback). |
21| [`model_context_window_exceeded`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#model-context-window-exceeded) | The response filled the model’s context window. | Treat the response as truncated. |
13| Value | When it occurs | What to do |
14| ----- | ----- | ----- |
15| [`end_turn`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#end-turn) | Claude completed its response naturally. | Use the response. |
16| [`max_tokens`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#max-tokens) | The response reached your `max_tokens` limit. | Raise `max_tokens` or [continue the response](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#ensuring-complete-responses). |
17| [`stop_sequence`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#stop-sequence) | Claude emitted one of your `stop_sequences`. | Read `stop_sequence` to see which one fired. |
18| [`tool_use`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#tool-use) | Claude is calling a tool. | Run the tool and return the result. A server tool call still missing its result block completes in a later response. |
19| [`pause_turn`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#pause-turn) | A server-tool loop reached its iteration limit. | Send the assistant content back to continue. |
20| [`refusal`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#refusal) | Claude declined to respond. | Read `stop_details` and [retry on a fallback model](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback). |
21| [`model_context_window_exceeded`](https://platform.claude.com/docs/en/build-with-claude/handling-stop-reasons#model-context-window-exceeded) | The response filled the model’s context window. | Treat the response as truncated. |
2222 
2323## The stop\_reason field
2424 
from line 1541
15411541 
15421542Each of these mistakes in the follow-up request fails with a 400 `invalid_request_error`. The messages shown are for web search. For other server tools, the names in them differ.
15431543 
1544| Mistake | The error message includes |
1545| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
1546| `tools` no longer defines the waiting server tool | ``but no `web_search` tool was provided`` |
1547| Text or other content comes after the `tool_result` blocks | ``was found without a corresponding `web_search_tool_result` block`` |
1548| With programmatic tool calling, text or other content comes after the `tool_result` blocks | `only tool_result blocks are allowed` |
1549| Text or other content comes before the `tool_result` blocks | `` `tool_use` ids were found without `tool_result` blocks immediately after `` |
1550| A `tool_result` block is missing | `` `tool_use` ids were found without `tool_result` blocks immediately after `` |
1544| Mistake | The error message includes |
1545| ----- | ----- |
1546| `tools` no longer defines the waiting server tool | ``but no `web_search` tool was provided`` |
1547| Text or other content comes after the `tool_result` blocks | ``was found without a corresponding `web_search_tool_result` block`` |
1548| With programmatic tool calling, text or other content comes after the `tool_result` blocks | `only tool_result blocks are allowed` |
1549| Text or other content comes before the `tool_result` blocks | `` `tool_use` ids were found without `tool_result` blocks immediately after `` |
1550| A `tool_result` block is missing | `` `tool_use` ids were found without `tool_result` blocks immediately after `` |
15511551 
15521552Content after the `tool_result` blocks fails because it ends Claude’s turn while the server tool is still waiting. To give Claude more input, continue until a response’s `stop_reason` is neither `tool_use` nor `pause_turn`. Then, send the input as a new user message in the same `messages` list.
15531553 
Feedback