Ollama bug: JSON schema skipped when thinking model answers without thinking
Since Ollama 0.34.4, format schemas are applied to thinking models as a single grammar that leaves the answer unconstrained if the model skips its thinking block. On gemma4:e2b all 8 non-thinking replies came back as bare text (391, Paris) with HTTP 200. The open fix ollama/ollama#18783 made the model think first in all 16 replayed requests.
- Since 0.34.4 schema and thinking are merged into one grammar in llm/llama_server.go
- 8 of 8 replies that skipped thinking violated the schema; 16 of 16 that thought first matched it
- With think: false the schema applies from the first token and always yields the right shape
- Fix #18783 adds the opening tag so the model thinks before answering
Read next
Software