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

OpenCode error

OpenCode: AI_APICallError ... tool_use ids were found without tool_result blocks

Error message
AI_APICallError: messages.13: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01CfJCsh21fK1pAXsXWYJYBA, toolu_01NoqnwsaxoK3AYM2FyrxmjN. Each `tool_use` block must have a corresponding `tool_result` block in the next message.

Status: Fixed in releaseLast verified 2 documented fixes4 sources

What it means

The session history sent to an Anthropic model contains a tool call with no matching tool result, so the API rejects every later request in that session.

Causes

  • A maintainer asked whether it happened after an abort, meaning a request was aborted and the conversation then continued (#1662).
  • A maintainer: "this is a bug with the anthropic api itself it sends back duplicate content or something and messes up the state of the client. We can fix it on our end its just a little messy reordering things all the time" (#1662).

How to fix it

  1. Fix 1.

    Fixed by PR #22646 "fix: ensure tool_use is always followed by tool_result", merged 2026-04-15, which closed #1662. The next release after the merge was v1.4.7. Upgrade.

    Terminal
    opencode upgrade
  2. Fix 2.

    An earlier related fix shipped in v1.0.164: "Fixed user invoked subtasks that were causing tool_use or missing thinking signatures".

More OpenCode errors

All 17 OpenCode errors

FAQ

What does "AI_APICallError ... tool_use ids were found without tool_result blocks" mean in OpenCode?

The session history sent to an Anthropic model contains a tool call with no matching tool result, so the API rejects every later request in that session.

How do I fix "AI_APICallError ... tool_use ids were found without tool_result blocks"?

There are 2 documented fixes. Start with the first: Fixed by PR #22646 "fix: ensure tool_use is always followed by tool_result", merged 2026-04-15, which closed #1662. The next release after the merge was v1.4.7. Upgrade.

Is this OpenCode error fixed?

Status: Fixed in release. A release fixed this. The affected versions note says where the fix landed. Affected versions: Reported from v0.5.x through early 2026 (also on 1.0.157). Fixed by PR #22646 (merged 2026-04-15).

Sources

Last verified against 4 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.