Session lockdown when using ollama and exceeding context window
Author: josegomezrCreated Sep 29, 2026Updated Sep 29, 2026
Labelsarea: sessionprovider: ollama
Description
I've noticed that a session will lock completely up with:
bad request: invalid content type: <nil>When the last response from the ollama model is cut short with:
,{"type":"finish","data":{"reason":"max_tokens","time":1790690695}}`The model response only contains reasoning but no content, nor tool calls, just aborts with "max tokens".
When that response is received, any other message is rejected immediately by ollama with the aforementioned error message.
As a workaround, one can delete the session messages from the incomplete response onward and get ollama to re-interact with crush. But it's quite annoying to close, sqlite3, ran some statements and re-open the session
Version
V0.96.1
Environment
tmux under linux
Source: charmbracelet/crush