Repository navigation
Closed
Description
With a qwen 2.5 model I can do this:
curl http://localhost:12434/engines/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5:3B-F16",
"stream": true,
"messages": [
{"role": "system", "content": "you are a helpful assistant."},
{"role": "user", "content": "hello, how are you?"},
{"role": "system", "content": "docker model runner rocks"},
{"role": "user", "content": "what is docker model runner?"}
]
}'With a qwen 3.5 model, If I try the same:
curl http://localhost:12434/engines/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "huggingface.co/unsloth/qwen3.5-4b-gguf:Q4_K_M",
"stream": true,
"messages": [
{"role": "system", "content": "you are a helpful assistant."},
{"role": "user", "content": "hello, how are you?"},
{"role": "system", "content": "docker model runner rocks"},
{"role": "user", "content": "what is docker model runner?"}
]
}'I get this error:
{"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 85, column 32 in source:\n...first %}↵ {{- raise_exception('System message must be at the beginnin...\n ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}the chat template contains this:
{%- if message.role == "system" %}
{%- if not loop.first %}
{{- raise_exception('System message must be at the beginning.') }}
{%- endif %}When the client sends a system message anywhere other than position [0] in the messages array, the template raises an exception and the server returns 500.
Metadata
Metadata
Assignees
Labels
No labels
Activity
ericcurtin commentedon Apr 3, 2026
@k33g if on mac could you run this against the latest llama.cpp :
llama-server -hf unsloth/qwen3.5-4b-gguf:Q4_K_M
or
llama-server --jinja -hf unsloth/qwen3.5-4b-gguf:Q4_K_M
if it's still an error, let's log a llama.cpp bug.
ericcurtin commentedon Apr 3, 2026
It's an illegal request, this is how you should do this: