Codex Desktop thread corruption after image generation/insert causes BODY_PARSE_FAILED and unreadable sessions
What version of the Codex App are you using (From “About Codex” dialog)?
26.527.3686.0
What subscription do you have?
Unknown
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What issue are you seeing?
After generating or inserting images in Codex Desktop, subsequent turns fail with BODY_PARSE_FAILED / Invalid JSON in request body. In multiple sessions, the underlying rollout-*.jsonl thread file became invalid JSON and the thread had to be manually repaired.
Observed behavior:
- A new thread initially works.
- After image generation and/or image insertion, follow-up messages fail with BODY_PARSE_FAILED.
- Some corrupted threads also become difficult or impossible to reopen normally.
- The problem is reproducible across multiple thread IDs, not isolated to one session.
Confirmed thread IDs:
- 019e72e2-4325-7d41-bf26-3d591d30be82
- 019e735d-8cf0-7541-ac5c-7e66fd1b4cae
- 019e7c49-2c06-7f81-8cbc-e977f685f003
What steps can reproduce the bug?
- Start a new Codex Desktop session.
- Work in a project located on a non-ASCII Windows path. In my case the original project path was under D:\丽爱说.
- Generate or insert images in the thread.
- Continue chatting after image generation finishes.
- The session eventually fails with:
{"error":{"code":"BODY_PARSE_FAILED","message":"Invalid JSON in request body.","type":"invalid_request_error"}}
Strongest reproduction evidence:
- Thread: 019e7c49-2c06-7f81-8cbc-e977f685f003
- Rollout file: C:\Users\a\.codex\sessions\2026\05\31\rollout-2026-05-31T12-27-10-019e7c49-2c06-7f81-8cbc-e977f685f003.jsonl
- Line 1 already contained a broken cwd value similar to: "cwd":"D:\\涓界埍璇?,..."
- Lines 175-177 were giant image outputs written inline as data:image/png;base64,... payloads.
- Those lines were approximately 3,131,614 / 2,916,574 / 2,299,278 characters long.
Additional affected sessions:
- 019e72e2-4325-7d41-bf26-3d591d30be82
- 019e735d-8cf0-7541-ac5c-7e66fd1b4cae
I had to manually repair corrupted rollout files multiple times in order to reopen or continue affected sessions.
What is the expected behavior?
Codex Desktop should always write valid JSONL session logs. Image generation / insertion should not corrupt the thread. Paths such as cwd/workdir should be serialized safely even when source paths contain non-ASCII characters. Image outputs should not be stored inline as multi-megabyte base64 data URLs inside rollout thread logs; file references, resource IDs, or short metadata summaries would be safer.
Additional information
Likely root cause:
- Session/thread serialization is not safely escaping some non-ASCII or garbled cwd/workdir/path values.
- Image generation results are being stored inline in rollout as huge base64 data:image/png payloads rather than lightweight references.
- Once the rollout contains malformed JSON and/or oversized inline payloads, later thread continuation or request-body reconstruction fails and surfaces as BODY_PARSE_FAILED.
User impact:
- Image workflows become unreliable.
- Threads become unusable after image generation/insert.
- Manual offline repair of .codex\sessions\...\rollout-*.jsonl is required to continue working.
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
The three threads that became invalid JSON after image generation—especially the broken first-line
cwdplus multi-megabyte inline image records—are strong real parser/recovery cases.I’m testing Codex Rescue’s bounded JSONL diagnosis against this shape. It will not rewrite non-ASCII paths, strip images, or claim to fix
BODY_PARSE_FAILED. It leaves the original rollout untouched and can only salvage what is durably parseable; ambiguous state remains fail-closed.If you kept an untouched backup from before manual repair, could you try:
pipx install codex-rescue==0.1.0a3codex-rescue sessionscodex-rescue doctor --latestSanitized output is enough—please don’t share raw rollouts, images, databases, prompts, repository files, private paths, or secrets.
https://github.com/shleder/codex-rescue