# Translation silently truncated when JSON stream parsing breaks (no error raised)

**URL:** https://meta.discourse.org/t/translation-silently-truncated-when-json-stream-parsing-breaks-no-error-raised/407251
**Category:** Bug
**Tags:** ai, dynaloc
**Created:** [10 ביולי,‏ 2026,‏ 9:31am UTC](https://meta.discourse.org/t/translation-silently-truncated-when-json-stream-parsing-breaks-no-error-raised/407251 "2026-07-10T09:31:25Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Denis\_Kovalenko](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/denis_kovalenko/32/549496_2.png) [@Denis\_Kovalenko](https://meta.discourse.org/u/Denis_Kovalenko)
#### Post date: [10 ביולי,‏ 2026,‏ 6:20pm UTC](https://meta.discourse.org/t/translation-silently-truncated-when-json-stream-parsing-breaks-no-error-raised/407251/2 "2026-07-10T18:20:13Z")

</div>

Adding a data point to this — we’re seeing what looks like the same underlying  
mechanism, but manifesting differently.

**Observed on:** Discourse core + discourse-ai, LLM: GPT-5.1 via OpenAI (custom API connection, not a seeded model).

**Reproduction evidence**

Same source post (Russian, ~2000 chars, headers/bold/bullet lists/links),  
translated into multiple locales via native AI translation:

- Polish (pl): the embedded image markdown lost its structure — went from  
`![alt text|690x460](upload://...)` to a malformed link missing the `!`  
prefix and the `|` separator, with the alt text and dimensions run  
together as plain text. Rendered as a clickable link instead of an  
embedded image.
- Ukrainian (uk): literal `\n\n` sequences appear as plain text throughout  
the entire post, in place of paragraph breaks. The image markdown in this  
same translation was intact — so the corruption isn’t tied to one fixed  
symptom, it varies by run.

Unlike the truncation described above, our case shows no missing content —  
the full text is present, but with corrupted escape sequences / markdown  
syntax rather than a shortened output. Different provider (OpenAI vs Google  
here), different symptom (corruption vs truncation), same suspected root:  
StructuredOutput#read\_buffered\_property falling back to  
BestEffortJsonParser#extract\_key, which doesn’t unescape JSON string  
sequences (`\n` stays literal) and appears to also mishandle special  
characters adjacent to markdown syntax when the fallback triggers mid-parse.

No errors in Sidekiq or Rails logs on our side either — same silent-failure  
behavior.

---

_[View the full topic](https://meta.discourse.org/t/translation-silently-truncated-when-json-stream-parsing-breaks-no-error-raised/407251)._
