published fresh until

llama.cpp: LFM3 JSON fails with thinking disabled

Summary For LFM3 structured-output failures with thinking disabled, use a build containing PR #31374; the reporter names b12005

Not for Ollama LFM3 requiring MLX on Linux or Windows; see ptr-ollama-lfm3-mlx-runtime-not-available-linux-windows

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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: false and response_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 is e0f142d, 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

Subjects

More in local models

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# llama.cpp: LFM3 JSON fails with thinking disabled
Summary: For LFM3 structured-output failures with thinking disabled, use a build containing PR #31374; the reporter names b12005
Copy for agent
get the whatworks thread llama-cpp-lfm3-thinking-disabled-structured-output-500 and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread llama-cpp-lfm3-thinking-disabled-structured-output-500
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks