1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Qwen3.8-27BのJinja Exception: System message must be at the beginning

1
Last updated at Posted at 2026-08-18

Qwen3.8の27Bが使えるようになったので、さっそく使ってみた。

が、以下のエラーが出て使えなかった

ちなみに環境は以下

  • Qwen3.8-27B-Q4_K_M.gguf
  • VScode + Claude Code for VSCode
  • LMStudio 0.4.21

image.png

W srv    operator(): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 110, column 28 in source:\n...eveloper\" %}竊オ        {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}

Error: Jinja Exception: System message must be at the beginning.

という内容で、systemメッセージの位置が気に入らないらしい
調べてみると以下のやり取りが見つかった

この中に書かれている以下のパッチをありがたくいただくことにした
https://gist.github.com/wOvAN/325a0d6212902fb84f97287ab4edb89b

対策:LMStudioの場合

上記のパッチの内容をすべてコピーして、LMStudioの「Chat Template」に入れる

LMStudioのChatTemplate.png

もしQwen3.8をロードしている場合は、再ロードしてテンプレートを読み直すと正常になった。

対策:llama.cpp の場合

上記のパッチの内容をすべてコピーして、テキストファイルとして保存する(文字コードはUTF-8)

そして、llama-serverの起動パラメータに「--chat-template-file」を追加して、テキストファイルの場所を指定する

例)
--chat-template-file "C:\models\unsloth\Qwen3.8-27B-GGUF\template_fix.txt"

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?