What this thread does
Unexpected empty grammar stack after accepting piece: 6 (30) — move LFM3 structured-output traffic to a llama.cpp build containing PR #31374.
A request for JSON fails with HTTP 500 when thinking is disabled through both the template and a zero reasoning budget.
Do first: run llama-server --version and choose a build containing commit 3c809f44383bcebc318b8cddd8c6d11aaa861e9b from PR #31374.
Evidence: the repair merged October 30; bamartinez2's October 30 follow-up reports recovery on released b12005. Other templates and model families need separate checks.
Not for: Ollama LFM3 requiring MLX on Linux or Windows; see the MLX runtime error.
What changed
- The repair description identifies the combination of
--reasoning-budget 0,enable_thinking: falseandresponse_format. The template already closes the thinking block, but the budget logic forces another closing tag. - The fix stops budget forcing when the end tag is already present in the prompt. Its merge commit is
3c809f4; b12005 was released later on October 30. That release's own tip ise0f142d, so do not treat the build label and fix commit as identical identifiers.
Do first: retain the JSON constraint after updating
1. Record the binary build and the exact GGUF/template you use. The failure report names b11946 and LFM3-1.7B Q8_0 on CUDA 12. Affected setup 2. Use a build containing the merged repair. The reporter's recovery build is b12005; it is an evidence-backed target, not a claim that it was the first fixed build. 3. Retain your original response_format and replay the request with thinking disabled. For the reported configuration, the relevant launch controls are:
llama-server -m LFM3-1.7B-Q8_0.gguf --port 8080 \
--jinja --reasoning-budget 0
And the relevant request fields on POST /v1/chat/completions are:
{
"messages":[{"role":"user","content":"Return a JSON object with a short title."}],
"max_tokens":256,
"chat_template_kwargs":{"enable_thinking":false},
"response_format":{"type":"json_object"}
}
The b12005 server reference documents the template kwargs, JSON response format and reasoning budget. Keep your existing backend/offload settings; the example only isolates the relevant controls.
4. Check HTTP status, parse the final content, and apply your application schema. Replay your schema-constrained form too if you normally use json_schema; plain JSON-object output is a different constraint.
Diagnostic: Unexpected empty grammar stack after accepting piece: 6 (30)
The collision happens before ordinary JSON content can be accepted: the server adds a reasoning-end tag after the template has already ended reasoning. The official LFM3 template contains the thinking-enabled and thinking-disabled branches; the repair explains their interaction with the budget sampler.
Removing response_format is a diagnostic comparison, not a replacement for constrained output. Likewise, the documented reasoning_format: "none" controls parsing of thoughts; it does not mean a zero thinking budget. Server parameter definitions
Evidence and limits
bamartinez2’s October 30 follow-up reports four successful schema-constrained calls with thinking disabled, also covers JSON-object output, and describes running with “no fallback”. These are public deployment observations, not a guarantee for every quantization or custom template. bamartinez2's report
This repair concerns the duplicate reasoning-end tag. A separate grammar-conversion failure, a malformed schema or an unsupported model loader needs its own diagnosis.
Started from a post by @tdakhran; bamartinez2, packaged by the editor. Original post