Skip to content

[BUG]: Error switching from thinking model to non-thinking model mid-session #11571

Closed

Description

@okossa

Description

When switching from a model with extended thinking (e.g., Claude Opus with thinking enabled) to a model without thinking support (e.g., GPT 5.2, Claude Sonnet without thinking) mid-session, an error occurs:

messages.1.content.0.thinking: each thinking block must contain thinking

Root Cause

The reasoning parts from the previous model's responses are stored in the message history. When switching to a model that doesn't support interleaved reasoning (capabilities.interleaved === false), these parts are still sent to the API, causing validation errors.

Steps to Reproduce

  1. Start a conversation with Claude Opus (or any model with extended thinking)
  2. Get a response that includes thinking/reasoning blocks
  3. Switch to GPT 5.2 or Claude Sonnet (without thinking enabled) mid-session using Ctrl+M
  4. Send a new message

Expected Behavior

Switching models mid-session should work seamlessly. OpenCode should strip reasoning parts from message history when the target model doesn't support them.

Actual Behavior

API error about invalid thinking blocks.

Environment

  • OpenCode version: 0.0.0-dev
  • OS: macOS
  • Provider: Anthropic / OpenAI

Related Issues

Activity

  1. github-actions commented on Feb 1, 2026

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case.

  2. added a commit that references this issue on Feb 1, 2026
    2b815c1
  3. added 14 commits that reference this issue on Feb 1, 2026
  4. wildcatDownstairs commented on Feb 2, 2026

    @wildcatDownstairs

    I also got this problem
    Image

  5. rekram1-node commented on Feb 2, 2026

    @rekram1-node
    Collaborator

    Fixed in next release, copilot specific issue

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