This issue has been created
 
 
LLM AI Integration / cid:jira-generated-image-avatar-a7f8c1fb-22fd-45af-a455-48a52f208356 LLMAI-181 Open

Chat UI fails with "Unterminated string in JSON" when streaming long responses

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-2ac7f10a-53be-4fb4-9f78-555f1de8b392 Rene van t Hof created this issue on 14/Sep/26 16:38
 
Summary: Chat UI fails with "Unterminated string in JSON" when streaming long responses
Issue Type: cid:jira-generated-image-avatar-a7f8c1fb-22fd-45af-a455-48a52f208356 Bug
Affects Versions: 0.9
Assignee: Unassigned
Created: 14/Sep/26 16:38
Environment: - XWiki on Debian 13 / Tomcat 11
- LLM Application (BETA) 0.9 + Index for the LLM Application 0.9
- Backend: Ollama 0.34.0 (OpenAI-compatible /v1 API) behind a Caddy
  reverse proxy with flush_interval -1 (no buffering)
- Model: gemma3:12b, RAG context enabled (8 chunks, ~2000 chars each)
- "Can Stream" enabled on the server configuration
Priority: cid:jira-generated-image-static-major-aff697ae-efd1-42a1-8f10-db82d8325bb0 Major
Reporter: Rene van t Hof
Description:

Environment:

  • XWiki on Debian 13 / Tomcat 11
  • LLM Application (BETA) 0.9 + Index for the LLM Application 0.9
  • Backend: Ollama 0.34.0 (OpenAI-compatible /v1 API) behind a Caddy
      reverse proxy with flush_interval -1 (no buffering)
  • Model: gemma3:12b, RAG context enabled (8 chunks, ~2000 chars each)
  • "Can Stream" enabled on the server configuration

Steps to reproduce:
1. Ask a question that produces a long streamed response (RAG context
   included, total response body roughly 12-17 KB)
2. Intermittently, the chat shows:
   "An error occurred: Unterminated string in JSON at position 13303
   (line 1 column 13304)"

Observed on multiple occasions at different positions (12363, 13303,
17438), always mid-string, always on longer responses. Short responses
stream fine.

Workaround: unchecking "Can Stream" on the server configuration makes
the problem disappear entirely, so the response content itself is valid.
This suggests the client-side parser fails when a JSON string is split
across SSE chunk boundaries.