Skip to content

Assistant messages missing thinking block in conversation history when extended thinking is enabled #20427

Closed as not planned

Description

@lian-xiao-xi

Description

When using an Anthropic-compatible API provider with extended thinking enabled, opencode does not include the thinking content block in assistant messages when replaying conversation history. This may cause downstream errors like:
{
"error": {
"type":"invalid_request_error",
"message": "thinking is enabled but reasoning_content is missing in assistant tool call message at index 1"
}
}

Plugins

No response

OpenCode version

1.3.3

Steps to reproduce

  1. Configure opencode to use an Anthropic-compatible provider (e.g. Moonshot API: https://api.moonshot.cn/anthropic/v1/messages)
  2. Select kimi-k2.5 under ZenMux as the provider
  3. Enable extended thinking with budget_tokens
  4. Trigger a multi-turn conversation that involves tool use (e.g. type "Please search for news about opencode"), which causes the model to invoke a tool call followed by a tool result
  5. The second API request fails with the error above

Screenshot and/or share link

Image

Operating System

macOs Sonoma 14.8.3

Terminal

No response

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 1, 2026
  2. github-actions commented on Apr 1, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is the same, please consider adding a comment there instead or linking these issues together.

  3. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions