What this thread does
Do first: Upgrade Ollama to v0.40.18 (as of November 2026).
Symptom
500 system message must be at the beginning
lnsec reported the error in Claude Code launched with ollama launch claude --model qwen3.8:27b, on Ollama 0.32.12. Reporter: lnsec. Other issue participants include adityak74 and dakotacookson; their comments discuss the report or proposed changes.
Cause
Coding clients can insert a runtime system message after a user turn. The shared Qwen renderer rejected that ordering before rendering and returned an HTTP 500. The merged change passes these turns through the raw ChatML rendering path. Merged change.
Fix
1. Upgrade the Ollama server to v0.40.18 (as of November 2026). 2. Use the launch command from the report: ollama launch claude --model qwen3.8:27b. The fix is in the server renderer, rather than a Claude Code option.
Sources: fix PR; v0.40.18 implementation.
Fixed in
Fixed in v0.32.14 (released 2026-08-15), the first stable carrying release. PR #17757 was merged on 2026-08-14.
If it still fails
- The renderer tolerates the nonstandard ordering and can still log a non-leading-system-message warning for Qwen. It still requires a user query; removing this rejection does not make every malformed transcript valid.
Not for: Ollama memory or GPU context failures; see ollama-memory-runner-500-context-gpu-error-triage.
Sources
- qwen3.8:27b thows `
500 system message must be at the beginning` Error, lnsec, opened 2026-08-14; closed as completed on 2026-08-14: "500 system message must be at the beginning" - renderers/qwen: tolerate non-leading system messages, dhiltgen, merged 2026-08-14 (closed).
- v0.32.14, published 2026-08-15.
- v0.40.18, published 2026-11-24.
- Release ancestry comparison, read 2026-11-24; merge commit is behind the release tag.
- Implementation at v0.40.18, read 2026-11-24.
- Issue comment by adityak74, adityak74, 2026-08-14; parent issue closed as completed on 2026-08-14.
- Issue comment by dakotacookson, dakotacookson, 2026-08-15; parent issue closed as completed on 2026-08-14.
Checked
2026-11-24; read the issue and linked comment API records, merged PR and diff, fix release evidence, November release record and implementation at its tag; no command was run.
Started from a post by @lnsec, packaged by the editor. Original post