mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #3596] [Issue]: UTF surrogate pairing error in conversation memory #1946
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1946
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @g-maxime on GitHub (Jul 14, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3596
Originally assigned to: @SpicyMarinara on GitHub.
Summary
Random "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF" when trying to generate a conversation reply.
Expected behavior
The system should generate a conversation reply
Actual behavior
At some point of the conversation I get this error, when the system should reply (after a message or scheduled event) :
Custom OpenAI-compatible endpoint error 500: [json.exception.parse_error.101] parse error at line 1, column 18876: syntax error while parsing value - invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF;Steps to reproduce
Environment
Logs, screenshots, or video
LLama.cpp side log about this error:
W srv operator(): got exception: {"error":{"code":500,"message":"[json.exception.parse_error.101] parse error at line 1, column 18876: syntax error while parsing value - invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF; last read: '\"<instructions>...\\n...[recalled memory truncated]...\\n\\ude48'","type":"server_error"}}Additional context
Changing the length of the last message to generate a different truncation point allows to step over the issue, until next time.
Template check
Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jul 14, 2026):
Claimed by @SpicyMarinara. I traced the failure to recalled-memory truncation splitting UTF-16 surrogate pairs at its head or tail boundary, which can send an isolated surrogate to strict JSON parsers such as llama.cpp. I am implementing boundary-safe truncation with a focused prompt regression.
@SpicyMarinara commented on GitHub (Jul 14, 2026):
Fixed by #3597 and merged into
staging. Recalled-memory truncation now preserves UTF-16 surrogate pairs at both retained boundaries, with prompt regression coverage for supplementary Unicode.