How to Use unsloth/Qwen3.8–27B-GGUF in Claude Code via Ollama Without Dying in the Process? (1/2) A clash between Claude Code's system-message injection and Qwen3.8's chat template causes a 500 error when using the unsloth/Qwen3.8–27B-GGUF model via Ollama, with the failure occurring in under 300 milliseconds during prompt assembly. The issue stems from Claude Code inserting system-role messages mid-conversation, which Qwen's Jinja template rejects, and Ollama is not at fault. The article, part one of a guide, explains the root cause and promises a template patch in part two. It’s 11 p.m. You have 27 billion parameters sitting comfortably on your GPU, Claude Code installed, and the Ollama server running. You type your first prompt and get this: Error: Jinja Exception: System message must be at the beginning. GIN | 500 | 262.037611ms | POST "/v1/messages?beta=true" You try again. Same error. You download the model again. You reinstall Ollama. You reinstall Claude Code. Nothing. You check the firewall, the endpoints, the tunnel. Still nothing. And then comes the best part: you run ollama run with that same model, and it works perfectly. It converses, reasons, and responds. But as soon as you connect it to Claude Code, you get a 500 error in less than 300 milliseconds. Calm down. It’s not your GPU. It’s not quantization. It’s not Ollama. And no, it’s not the mischievous spirits having a field day with you either. It’s a clash of conventions between two ecosystems that never sat down to agree on where system messages can go within a conversation. This first part is about understanding the problem and patching the template. In the second part, we’ll create the models, deploy them, and connect Claude Code. Plus, a few tips on what worked reasonably well for me. Those three hundred milliseconds are the first clue. Your GPU never even found out about it: the request died during prompt assembly, before generating a single token. What failed wasn’t inference, it was the chat template: a Jinja program that travels inside the GGUF file itself, in the tokenizer.chat template metadata, whose job is to turn your conversation’s message list into the plain text the model actually sees role tokens, turn delimiters, generation prefix . Qwen3.8’s template has a rule written into it: system role messages go at the beginning of the conversation, and nowhere else. If one shows up mid-history, the template aborts rendering with an exception, and the text of that exception is literally the text of your 500 error. In Step 3 we’ll open the file and see the exact line; for now, let’s just hold onto the rule. And who’s sending a system message mid-conversation? Claude Code. Since around May 2026, in addition to the “official” system prompt that travels as a parameter separate from the history, Claude Code injects {“role”: “system”, …} messages directly inside the messages array. It uses them for prompt caching and to slip context between turns, and it doesn’t need a long conversation to do it: they travel from the session’s very first requests. That’s why it fails on the first prompt. The change, in fact, broke half the ecosystem of API proxies and translators all at once; it’s documented as a breaking change in several projects. Ollama isn’t the culprit, and it’s worth saying so because it’s the first place anyone looks. That this story is even possible is to its credit: the /v1/messages?beta=true in the log is the support for Anthropic’s Messages schema that Ollama exposes precisely so clients like Claude Code can talk to local models. The ?beta=true , by the way, doesn’t mean Ollama’s support is in beta: it’s a query param that Claude Code itself adds to announce the Anthropic API beta features it uses it sends the same thing to /v1/messages/count tokens?beta=true . And that layer does its job well: it translates the request and hands the template the conversation exactly as the client sent it, no more and no less. The clash isn’t Ollama against anyone: it’s Claude Code’s new habit against the discipline of Qwen’s template, with Ollama as the faithful messenger in the middle. Nor is it the famous