Uploaded image for project: 'LLM AI Integration'
  1. LLM AI Integration
  2. LLMAI-181

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 0.9
    • None
    • Unknown

    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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Rene Rene van t Hof
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: