Skip to content

[BUG]: Empty content error when switching from Cerebras GLM to Claude Opus #11991

Closed

Description

@srs-adamr

Problem

When switching from Cerebras GLM 4.7 to Claude Opus 4.5 in the same session, I get this error:

messages.1: all messages must have non-empty content except for the optional final assistant message

This makes it impossible to switch between models during development sessions.

Steps to Reproduce

  1. Start a session with build agent (Cerebras GLM 4.7)
  2. Send a few messages
  3. Switch to plan agent (Claude Opus 4.5 with extended thinking)
  4. Try to send a message
  5. Error occurs

Environment

  • OpenCode version: 1.1.49
  • Provider: Cerebras (GLM 4.7) → Anthropic (Opus 4.5)
  • OS: macOS

Related Issues

Notes

Activity

  1. github-actions commented on Feb 3, 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. srs-adamr commented on Feb 3, 2026

    @srs-adamr
    Author

    Correction: This is NOT a duplicate of #6418.

    After deeper analysis, this is a different error with a different root cause:

    Issue Error Root Cause Fix
    #6418 Invalid signature in thinking block GLM thinking blocks have incompatible signatures PR #11569 (merged)
    This issue all messages must have non-empty content GLM reasoning parts stripped, leaving empty message PR #11882 (OPEN)

    The Failure Path

    1. Use Cerebras GLM 4.7 (produces reasoning/thinking parts)
    2. Switch to Claude Opus (Anthropic provider)
    3. Empty content filter runs BEFORE GLM reasoning is processed
    4. GLM reasoning handler strips reasoning parts → message now has empty array
    5. Claude API rejects: "non-empty content"

    Why PR #6383 (in v1.1.49) doesn't fix this

    PR #6383 filters messages with only step-start parts. But GLM reasoning parts are NOT step-start parts - they pass the filter, then get stripped later, leaving empty content.

    Required Fix

    PR #11882 handles this by:

    1. Converting GLM thinking blocks to text (preserving content)
    2. Filtering empty content AFTER processing (not before)

    PR #11882 is currently OPEN with failing tests and merge conflicts.

    Environment

    • OpenCode: v1.1.49
    • Provider: Cerebras → Anthropic (NOT GitHub Copilot)
    • Models: cerebras/zai-glm-4.7 → anthropic/claude-opus-4-5
  3. github-actions commented on Apr 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 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