This repository contains a minimally patched Jinja chat template for Qwen3.8 Flash Next, based on the template embedded in unsloth/Qwen3.8-Flash-Next-GGUF.
It fixes HTTP 500 errors from llama-server when an agent client such as
OpenClaw places a system or developer message after a user, assistant, or
tool message.
Typical errors include:
Jinja Exception: System message must be at the beginning.
and:
Jinja Exception: System and developer messages must appear before all user,
assistant, and tool messages.
The strict exception:
{%- if message.role == "system" or message.role == "developer" %}
{{- raise_exception('System message must be at the beginning.') }}
is replaced with an in-place Qwen system block:
{%- if message.role == "system" or message.role == "developer" %}
{{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
This preserves the original message position instead of moving dynamic agent context to the beginning of the prompt. The rest of the Unsloth template, including vision content, reasoning controls, and tool-call formatting, is unchanged.
Download chat_template.jinja, then start the server with both Jinja and the template override enabled:
llama-server.exe `
--model path\to\model.gguf `
--jinja `
--chat-template-file path\to\chat_template.jinja
Keep any other model, vision-projector, context, GPU, and cache arguments you normally use.
Tested on October 11, 2026 with:
llama-cpp provider pluginunsloth/Qwen3.8-Flash-Next-GGUF/v1/chat/completionsThe following message orders returned HTTP 200:
system -> useruser -> assistant -> system -> useruser -> assistant -> developer -> userBefore the patch, the latter two returned HTTP 500 during Jinja rendering.
SHA-256 of this chat_template.jinja:
BACBF3031C74C7638D15FD348E2E61423C893B7E18D366F451501EEDDE46E26A
Chat templates can change between Qwen variants and model revisions. Compare
the template against your model's /props response before applying the same
edit to a different artifact.
Related reports:
The template is derived from Qwen3.8 Flash Next and the Unsloth GGUF template. See LICENSE and the linked upstream model repositories.
Have the files? Publish a torrent.
Publish a torrentHave the complete files and permission to share them? Replace the example folder path. The script checks the files, makes a torrent and submits its magnet and checksums. Keep your torrent client seeding. Get your community key from your settings, and read the script before running it.
curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo axiomofmind/Qwen-3.8-jinja-chat-template-openclaw-fix ./model-folderQwen/Qwen3.8-Flash-Next