Invalid or truncated JSON from the model
Symptom
Parsing fails; output has trailing text, markdown fences or is cut off.
Likely causes
- Prompt-only JSON requests on small models
- max_tokens reached before closing braces
- Temperature too high
How to fix it
- Use constrained decoding (JSON schema / grammar) instead of asking nicely.
- Raise max_tokens and lower temperature to 0 to 0.2.
- Validate the parsed object against your schema and retry on failure.
bash
# llama-server
"response_format": {"type": "json_schema", "json_schema": {"name": "out", "schema": {...}}}Still stuck? Check the lessons or measure first with the benchmark lab.