cd /news/ai-tools/six-json-schema-keywords-make-gemma-… · home › topics › ai-tools › article
[ARTICLE · art-180454] src=discuss.huggingface.co ↗ pub= topic=ai-tools verified=true sentiment=↓ negative

Six JSON Schema keywords make Gemma 4 31B return malformed tool-call arguments on Bedrock (minLength: 0/20 correct). Probe + write-up

Keiran Holloway reported that six JSON Schema keywords — minLength, maxLength, maxItems, minLength on array items, uniqueItems and, to a lesser degree, minItems and pattern — caused Gemma 4 31B on Bedrock's OpenAI-compatible endpoint to return malformed tool-call arguments, with minLength: 1, maxLength: 50, maxItems: 10, minLength on array items and uniqueItems each producing 0/20 correct calls versus 20/20 for the control. Holloway attributed the failures to the serving layer rather than the model, noting that empty arrays returned for maxItems and minLength-on-items are valid JSON so tools run with missing input, and recommended stripping the six keywords from the schema copy sent to Gemma while keeping validation on the tool server. The findings rest on 20 calls per arm, one model size and one host, with constrained decoding an unproven guess, and Holloway asked whether vLLM, llama.cpp or other hosted providers show the same behavior.

recommendation

Probe your tool schemas keyword by keyword with repeated calls before shipping; strip minLength, maxLength, maxItems, item-level minLength and uniqueItems from the copy sent to Gemma and keep validation server-side.

more in playbook: Evals and testing for LLM apps
read2 min views11 publishedDec 2, 2026

I spent a while chasing broken tool calls from Gemma 4 31B (Bedrock’s OpenAI-compatible endpoint) and narrowed part of it down to something I haven’t seen reported: specific JSON Schema keywords on a tool parameter.

Each keyword tested alone on a five-parameter tool, 20 calls per arm, with one earlier tool call in the history:

| Keyword on one parameter | Correct | What comes back |

|---|---|---|
| none (control) | 20/20 |  | 
| minLength: 1 | 0/20 | `":"` ,`"};network"` | 

| maxLength: 50 | 0/20 | same kind of thing | | maxItems: 10 | 0/20 | [] every time | | minLength on array items | 0/20 | [] every time | | minItems: 1 | 7/20 | malformed items | | pattern | 17/20 | value padded with dashes | | uniqueItems | 0/20 | HTTP 400 | | minimum, maximum, enum, default, format, anyOf null | 20/20 | |

Why I think it’s the serving layer and not the model:

The nasty ones are maxItems and minLength on items: an empty array is valid JSON, so your tool just runs with missing input.

Second trigger: free-form objects (no declared properties) and untyped arrays. Keys the model has to invent come back with stray punctuation, e.g. ",bool", ",must". Declared keys are fine.

Workarounds that held up for me: strip those six keywords from the schema copy sent to Gemma (keep validating on the tool server), and present free-form values as a string holding JSON text, then decode.

Caveats: one model size, one host, root cause unproven (constrained decoding is my guess), and 20 calls per arm. If your validation library emits these keywords (e.g. .min(1)), it’s worth checking your schemas.

Write-up: Six JSON Schema keywords that appear to corrupt Gemma 4 tool calls | Keiran Holloway Probe (single file, any OpenAI-compatible endpoint): GitHub - keiranholloway/gemma4-toolcall-probe: Probe an OpenAI-compatible endpoint for damaged Gemma 4 tool-call arguments · GitHub

Has anyone seen the same on vLLM, llama.cpp or another hosted provider? I’d like to know whether this is specific to Bedrock.

── more in #ai-tools 4 stories · sorted by recency
── more on @gemma 4 31b 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/six-json-schema-keyw…] indexed:0 read:2min 2026-12-02 · —