[GH-ISSUE #10015] Final stream chunk missing "done": true despite completed response #6567

Closed
opened 2026-04-12 18:11:44 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @jopersr on GitHub (Mar 27, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/10015

What is the issue?

In certain cases when using the /generate endpoint with "stream": true, the final chunk of the response stream includes all expected metadata (like infoContext and chatId), but the "done": true flag is missing — leaving the client unsure whether the stream has truly ended.

Relevant log output

curl --request POST \
  --url http://localhost:11434/api/generate \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "Title028",
    "options": {},
    "prompt": "Cuentame una historia de 50 parrafos sobre un dragon y un a princesa. En la histyoria debe aparecer un unicornio, un caballero y una matiposa magica. Esta historia sr[a para trabajar literatura con mis estudiantes de 8 años.",
    "stream": true
}'

Expected output (trimmed):
{ "response": "Once", "done": false }
{ "response": " upon", "done": false }
...
{ "response": ".", "done": true, "infoContext": {...}, "chatId": "..." }

Actual output (problematic case):
{ "response": ".", "done": false }
{ "response": ".", "done": false }
{ "response": ".", "done": false, "infoContext": {...}, "chatId": "..." }

Clients consuming the stream rely on the done: true flag to trigger proper UI updates and finalize processing.
When it is omitted, the frontend is left in an uncertain state, waiting for more chunks that will never come.

Even though the stream ends and metadata is received, the client is never officially told, “You’re done.”

OS

Linux

GPU

Nvidia

CPU

No response

Ollama version

llama3.1:8b

Originally created by @jopersr on GitHub (Mar 27, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/10015 ### What is the issue? In certain cases when using the /generate endpoint with "stream": true, the final chunk of the response stream includes all expected metadata (like infoContext and chatId), but the "done": true flag is missing — leaving the client unsure whether the stream has truly ended. ### Relevant log output ```shell curl --request POST \ --url http://localhost:11434/api/generate \ --header 'Content-Type: application/json' \ --data '{ "title": "Title028", "options": {}, "prompt": "Cuentame una historia de 50 parrafos sobre un dragon y un a princesa. En la histyoria debe aparecer un unicornio, un caballero y una matiposa magica. Esta historia sr[a para trabajar literatura con mis estudiantes de 8 años.", "stream": true }' Expected output (trimmed): { "response": "Once", "done": false } { "response": " upon", "done": false } ... { "response": ".", "done": true, "infoContext": {...}, "chatId": "..." } Actual output (problematic case): { "response": ".", "done": false } { "response": ".", "done": false } { "response": ".", "done": false, "infoContext": {...}, "chatId": "..." } Clients consuming the stream rely on the done: true flag to trigger proper UI updates and finalize processing. When it is omitted, the frontend is left in an uncertain state, waiting for more chunks that will never come. Even though the stream ends and metadata is received, the client is never officially told, “You’re done.” ``` ### OS Linux ### GPU Nvidia ### CPU _No response_ ### Ollama version llama3.1:8b
GiteaMirror added the bug label 2026-04-12 18:11:44 -05:00
Author
Owner

@rick-github commented on GitHub (Mar 27, 2025):

Actual output (problematic case):
{ "response": ".", "done": false }
{ "response": ".", "done": false }
{ "response": ".", "done": false, "infoContext": {...}, "chatId": "..." }

This is not output from ollama - there are no "infoContext" or "chatId" fields in ollama responses.

<!-- gh-comment-id:2758647441 --> @rick-github commented on GitHub (Mar 27, 2025): ``` Actual output (problematic case): { "response": ".", "done": false } { "response": ".", "done": false } { "response": ".", "done": false, "infoContext": {...}, "chatId": "..." } ``` This is not output from ollama - there are no "infoContext" or "chatId" fields in ollama responses.
Author
Owner

@jopersr commented on GitHub (Mar 27, 2025):

Was my fault, the problem was in our backend . Thanks for your response.

<!-- gh-comment-id:2759054745 --> @jopersr commented on GitHub (Mar 27, 2025): Was my fault, the problem was in our backend . Thanks for your response.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#6567