An Ollama reply with "response":"" and "done_reason":"load" means
the request carried no prompt: the server loaded the model and returned without
generating anything. Add a prompt (or messages on
/api/chat) to get text. With "keep_alive":0 and no prompt the
reply says "done_reason":"unload" instead.
The status is 200 and there is no error field, so code that only reads
response sees an empty string. Check done_reason: load
and unload are answers to a request with nothing to generate.
The error
The body file load.json is {"model":"qwen2.5:0.5b"}:
PS> curl.exe -s -i -d "@load.json" http://127.0.0.1:15191/api/generate
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
...
Content-Length: 115
{"model":"qwen2.5:0.5b","created_at":"2026-11-10T03:22:02.8865026Z","response":"","done":true,"done_reason":"load"}
The same body sent to /api/chat:
PS> curl.exe -s -i -d "@load.json" http://127.0.0.1:15191/api/chat
HTTP/1.1 200 OK
...
{"model":"qwen2.5:0.5b","created_at":"2026-11-10T03:22:02.9419312Z","message":{"role":"assistant","content":""},"done":true,"done_reason":"load"}
Why it happens
The request named a model and nothing else. Before it, /api/ps listed no
model on the test server; after it, qwen2.5:0.5b was listed:
PS> curl.exe -s http://127.0.0.1:15191/api/ps
{"models":[{"name":"qwen2.5:0.5b","model":"qwen2.5:0.5b","size":676079861,...,"expires_at":"2026-11-10T08:57:02.8865026+05:30","size_vram":676079861,"context_length":4096,"runner":"llamacpp"}]}
So a body without a prompt works as a "load this model now" call, which is useful to warm
a model up before the first real request. It becomes a bug when the prompt is missing by
accident. In the test, a chat body with messages sent to
/api/generate got the same "response":"" and
"done_reason":"load"; a body with the key spelled Prompt, capital
P, was answered normally.
The unload variant came from {"model":"qwen2.5:0.5b","keep_alive":0}, sent
while the model was loaded. /api/ps, called right after it, returned
{"models":[]}:
PS> curl.exe -s -i -d "@unload.json" http://127.0.0.1:15191/api/generate
HTTP/1.1 200 OK
...
{"model":"qwen2.5:0.5b","created_at":"2026-11-10T03:21:59.4803023Z","response":"","done":true,"done_reason":"unload"}
The fix
Put the text in prompt; this body returned an answer from the same server:
{"model":"qwen2.5:0.5b","prompt":"Explain in two sentences what a database index is.","stream":false,"options":{"num_predict":300,"seed":1}}
PS> curl.exe -s -d "@len300.json" http://127.0.0.1:15191/api/generate
{"model":"qwen2.5:0.5b","created_at":"2026-11-10T03:21:59.4143279Z","response":"A database index is a data structure that stores and organizes data in a way that allows efficient retrieval of related data based on user queries or search criteria. It helps to speed up data retrieval and search operations by providing a quick way to access specific pieces of information when needed.","done":true,"done_reason":"stop",...}
If you meant to load or unload a model, the empty reply is the success answer: read
done_reason and /api/ps to confirm. If you meant to generate,
log the exact body your code sends; the key must be prompt for
/api/generate and messages for /api/chat.
How it was reproduced
Ollama 0.40.14 (ollama --version) on Windows 11, run as a separate
ollama serve on 127.0.0.1:15191 with its own models folder and
qwen2.5:0.5b. The requests went through curl.exe from Windows
PowerShell 5.1 with ASCII body files, in this order: a generate with a prompt, the
keep_alive 0 unload, /api/ps, the load on
/api/generate, /api/ps, then the load body on
/api/chat.
Frequently asked
- Why does the Ollama API return an empty response?
- Check done_reason. If it says load, the request had no prompt, so the server loaded the model and generated nothing. Add a prompt for /api/generate or messages for /api/chat.
- What does done_reason unload mean in Ollama?
- The request named a model with keep_alive 0 and no prompt. The server unloaded the model; in the test /api/ps, called right after it, listed no models.
- How do I preload a model in Ollama without generating text?
- Send only the model name to /api/generate, for example {"model":"qwen2.5:0.5b"}. The reply has an empty response and done_reason load, and /api/ps then lists the model.
More decoded errors in the Fixes category. For the
keep_alive value format, see
the
Ollama API guide.