You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
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
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.
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.
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.
Activity
github-actions commentedon Apr 3, 2026
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.
lukpod1 commentedon Apr 3, 2026
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.
robertoberto commentedon May 23, 2026
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.
github-actions commentedon Jul 23, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.