Skip to content

Qwen3.6-plus model throws "System message must be at the beginning" error with image input in OpenCode 1.3.13; Qwen3.5-plus works normally #20813

Closed as not planned

Description

@ice5631024721

Description

Environment
OpenCode version: 1.3.13
Model: qwen3.6-plus / qwen3.5-plus
Describe the bugWhen using OpenCode 1.3.13 with the qwen3.6-plus model, an API error occurs if the input contains an image.The error message:
plaintext
<400> InternalError.Algo.InvalidParameter: The provided messages input is invalid. The error info is [System message must be at the beginning.].
Expected behaviorNo errors occur when using the qwen3.5-plus model with the same OpenCode version, the same input format, and image attachments. The issue only exists with qwen3.6-plus.

Plugins

No response

OpenCode version

1.3.13

Steps to reproduce

No response

Screenshot and/or share link

Image 而且我发现 如果报错之后 再次对话 但是去掉图片 还是会报错 如果关掉opencode 重新打开 继续对话 (没有图片)就不会有问题

Operating System

No response

Terminal

No response

Activity

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

    @github-actions
    Contributor

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

    If your issue is distinct (e.g., specific to image input triggering the error), please add details clarifying how it differs from the above.

  3. lukpod1 commented on Apr 3, 2026

    @lukpod1

    Not sure if this is related but I just ran into a similar issue with plan mode bypassing bash restrictions. I've opened a PR to fix the plan mode permissions over at #20930 (on my fork for now). The root cause was that the plan mode permission config didn't explicitly deny bash commands, so they were slipping through. Might be worth checking if the same thing is happening with Qwen's system message handling.

  4. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. robertoberto commented on May 23, 2026

    @robertoberto

    same root cause as #15059. the qwen 3.6 chat template raises raise_exception('System message must be at the beginning.') when messages[] contains more than one role: "system". image input isn't what triggers it, just tends to coincide with the second system fragment being added.

    opencode's title-generator path produces two consecutive system entries even on vanilla installs. diagnosis + fix snippet in #15059, currently-open PR is #16981.

  6. github-actions commented on Jul 23, 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