Name and Version
version: b454 (571d0d540), HIP/ROCm build (gfx1151 / Strix Halo), llama-server with --jinja. Behaviour also confirmed present on 2f18fe1 (Jun 26). (The failure is in json-schema→GBNF grammar construction, which is backend-independent — reproducible on any build.)
Operating systems
Linux
Which llama.cpp modules do you know to be affected?
llama-server (--jinja tool-call grammar / json-schema-to-grammar)
Problem description & steps to reproduce
When the request carries a large-but-realistic tool set, llama-server rejects it at grammar-build time:
HTTP 400 {"error":{"code":400,"message":"Failed to initialize samplers: failed to parse grammar"}}
The rejection arrives in ~0.13 s with no prefill and no GPU activity — it dies while compiling the combined tool-call grammar, before any inference. Single small tool sets work normally.
The trigger is cumulative schema size, not tool count and not any individual tool. Demonstrated by holding tool count constant and varying only total schema volume:
| tools |
tools-array JSON size |
result |
| 58 (set A) |
97,102 B |
HTTP 200 |
| 58 (set B — same count, larger-schema tools) |
100,026 B |
HTTP 400 |
Same count, different composition → the larger-volume set fails. So it is not tool count, and not a single culprit schema (the 50-tool base is identical in both sets; a fixed bad schema would fail both).
Boundary scan (base of 50 real tools + N additional real MCP tools), current build:
| total tools |
tools-array size |
result |
| 58 |
97,102 B |
200 |
| 59 |
97,935 B |
400 |
| 60 |
98,951 B |
400 |
| 65 |
103,348 B |
400 |
| 89 |
121,115 B |
400 |
The 200→400 crossover sits at ~97–98 KB of tools-array JSON (proxy for compiled-grammar size) for this tool mix. All failures return the identical error in ~0.1 s.
Real-world impact: the agent framework driving this (OpenClaw) treats the 400 as a provider failure and silently falls back to a cloud model — local inference stops with no user-visible error. The failure appeared when an installed MCP server's tools pushed the materialized set past the threshold.
Not explained by existing issues
Suspected mechanism
Total compiled GBNF size / rule-count exceeding an internal parser limit as tool schemas accumulate — a volume ceiling in json-schema-to-grammar + the GBNF parser, distinct from the shape triggers already tracked. Secondary observation: in default single-slot config this error is fatal and exits the server; with --parallel 2 the server survives and returns the 400.
Reproduction / offer
Reproducible on gfx1151 (ROCm) with Qwen3.5-122B-A10B and a real 96-tool MCP payload; the grammar-build path is backend-independent so it should reproduce anywhere with a comparably-sized tool set. I have a probe harness (adds real tool schemas to a base set; failures cost ~0.1 s / no prefill) and can share the payloads, and I'm happy to test candidate fixes on this hardware.
(Investigation and write-up done with AI assistance; all HTTP results from live runs on the machine described, reproducible on request.)
Name and Version
version: b454 (571d0d540), HIP/ROCm build (gfx1151 / Strix Halo),llama-serverwith--jinja. Behaviour also confirmed present on2f18fe1(Jun 26). (The failure is in json-schema→GBNF grammar construction, which is backend-independent — reproducible on any build.)Operating systems
Linux
Which llama.cpp modules do you know to be affected?
llama-server (
--jinjatool-call grammar / json-schema-to-grammar)Problem description & steps to reproduce
When the request carries a large-but-realistic tool set,
llama-serverrejects it at grammar-build time:The rejection arrives in ~0.13 s with no prefill and no GPU activity — it dies while compiling the combined tool-call grammar, before any inference. Single small tool sets work normally.
The trigger is cumulative schema size, not tool count and not any individual tool. Demonstrated by holding tool count constant and varying only total schema volume:
Same count, different composition → the larger-volume set fails. So it is not tool count, and not a single culprit schema (the 50-tool base is identical in both sets; a fixed bad schema would fail both).
Boundary scan (base of 50 real tools + N additional real MCP tools), current build:
The 200→400 crossover sits at ~97–98 KB of tools-array JSON (proxy for compiled-grammar size) for this tool mix. All failures return the identical error in ~0.1 s.
Real-world impact: the agent framework driving this (OpenClaw) treats the 400 as a provider failure and silently falls back to a cloud model — local inference stops with no user-visible error. The failure appeared when an installed MCP server's tools pushed the materialized set past the threshold.
Not explained by existing issues
MAX_REPETITION_THRESHOLD, top-level): merged April 2026; present in this build (b454). Reproduces regardless.maxLength ≥ 2000): static scan of all 96 tool schemas in the failing payload finds zero strings withmaxLength ≥ 2000and zeropatternfields at any depth. That trigger is absent here; and the cumulative-size behaviour above is inconsistent with a single-schema trigger.Suspected mechanism
Total compiled GBNF size / rule-count exceeding an internal parser limit as tool schemas accumulate — a volume ceiling in json-schema-to-grammar + the GBNF parser, distinct from the shape triggers already tracked. Secondary observation: in default single-slot config this error is fatal and exits the server; with
--parallel 2the server survives and returns the 400.Reproduction / offer
Reproducible on gfx1151 (ROCm) with Qwen3.5-122B-A10B and a real 96-tool MCP payload; the grammar-build path is backend-independent so it should reproduce anywhere with a comparably-sized tool set. I have a probe harness (adds real tool schemas to a base set; failures cost ~0.1 s / no prefill) and can share the payloads, and I'm happy to test candidate fixes on this hardware.
(Investigation and write-up done with AI assistance; all HTTP results from live runs on the machine described, reproducible on request.)