You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] v0.8.0 Introduced thinking block bug with Claude Sonnet 4: "AI_APICallError: messages.3.content.0.type: Expected thinking or redacted_thinking, but found text." #2599
When using Claude Sonnet 4 with thinking enabled on Opencode v0.8.0, an Anthropic api error happens after tool invocation. Only happens after tool call (specifically read).
Here is the full API error (not listed in chat context):
AI_APICallError: messages.3.content.0.type: Expected `thinking` or
`redacted_thinking`, but found `text`. When `thinking` is enabled, a final `assistant`
message must start with a thinking block (preceeding the lastmost set of `tool_use`
and `tool_result` blocks). We recommend you include thinking blocks from previous
turns. To avoid this requirement, disable `thinking`. Please consult our documentation
at https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking
I'm running into a similar issue with Claude 4.5 Sonnet hosted on Google Vertex (through openai-compatible proxy: LiteLLM...)
messages.3.content.0.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "messages.3.content.0.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking"
},
"request_id": "..."
}
still running into this frequently "messages.101: The final block in an assistant message cannot be thinking" every few tasks with claude opus in opencode
messages.581.content.0: When thinking is disabled, an assistantmessage in the final position cannot containthinking. To use thinking blocks, enable thinking in your request.
getting this constantly with claude opus with thinking mode on, usually after it calls MCPs, the next message has <thinking> tags visible and then when it stops generating, the error pops
I think this is somehow related to plugins and noReply/ignore messages.
Activity
rekram1-node commentedon Sep 14, 2025
thanks for raising, looks like it was due to these changes: #2577
rekram1-node commentedon Sep 14, 2025
I think the issue is that "providerOptions": {
"anthropic": {
"signature": "...."
}
}
Isn't being saved to the reasoning messages
shouldn't be hard to fix just need to find where
rekram1-node commentedon Sep 14, 2025
should be fixed in next release I tested with quite a few models
fix(session): pair reasoning with following text in prompts\n\nPreven…
jessevdp commentedon Oct 2, 2025
I'm running into a similar issue with Claude 4.5 Sonnet hosted on Google Vertex (through openai-compatible proxy: LiteLLM...)
{ "type": "error", "error": { "type": "invalid_request_error", "message": "messages.3.content.0.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. When `thinking` is enabled, a final `assistant` message must start with a thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks). We recommend you include thinking blocks from previous turns. To avoid this requirement, disable `thinking`. Please consult our documentation at https://docs.claude.com/en/docs/build-with-claude/extended-thinking" }, "request_id": "..." }Should I open a separate issue?
fix(antigravity): complete thinking block signature preservation (#256)
feat: add two-layer thinking block validation (proactive + reactive) (#…
VisionaryOS commentedon Dec 27, 2025
still running into this frequently "messages.101: The final block in an assistant message cannot be
thinking" every few tasks with claude opus in opencoderekram1-node commentedon Dec 27, 2025
@VisionaryOS can u share a session?
opencode export > session.json
Alumniminium commentedon Jan 7, 2026
messages.581.content.0: When thinking is disabled, anassistantmessage in the final position cannot containthinking. To use thinking blocks, enablethinkingin your request.getting this constantly with claude opus with thinking mode on, usually after it calls MCPs, the next message has
<thinking>tags visible and then when it stops generating, the error popsI think this is somehow related to plugins and noReply/ignore messages.
feat: add two-layer thinking block validation (proactive + reactive) (c…
feat: add two-layer thinking block validation (proactive + reactive) (c…