Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenCode error

OpenCode: Expected thinking or redacted_thinking, but found tool_use

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`.

Status: WorkaroundLast verified 2 documented fixes3 sources

What it means

With extended thinking enabled, Anthropic requires the previous assistant turn to start with its thinking block. The request OpenCode sent did not include that block.

Causes

  • Reasoning metadata lost in transit through a proxy. A maintainer in #3077: "The error that you reported for this issue is caused by missing metadata, if for whatever reason your proxy isnt properly transforming the chunks into openai compatible format, then opencode wont have 100% of the data it needs when sending requests to your proxy, so then it fails once it hits anthropic".

How to fix it

  1. Fix 1.

    If you route through a proxy such as LiteLLM, make sure it passes through all reasoning data. The maintainer pointed to the proxy as the likely cause (#3077).

  2. Fix 2.

    Upgrade. v1.0.164 "Fixed user invoked subtasks that were causing tool_use or missing thinking signatures". v1.18.26: "Claude 5 sessions now tolerate stale thinking blocks instead of failing after prompt or tool changes."

    Terminal
    opencode upgrade

More OpenCode errors

All 17 OpenCode errors

FAQ

What does "Expected thinking or redacted_thinking, but found tool_use" mean in OpenCode?

With extended thinking enabled, Anthropic requires the previous assistant turn to start with its thinking block. The request OpenCode sent did not include that block.

How do I fix "Expected thinking or redacted_thinking, but found tool_use"?

There are 2 documented fixes. Start with the first: If you route through a proxy such as LiteLLM, make sure it passes through all reasoning data. The maintainer pointed to the proxy as the likely cause (#3077).

Is this OpenCode error fixed?

Status: Workaround. No release removes the cause. The documented fixes work around it. Affected versions: Reported Oct 2025 through LiteLLM and Bedrock. Related fixes in v1.0.164 and v1.18.26.

Sources

Last verified against 3 sources: official docs, maintainer replies and release notes.

Newsletter

Fixes for the tools you use, weekly

One email per week. New coding agent releases, what broke, and how developers are working around it.