codex - 💡(How to fix) Fix Codex Desktop thread corruption after image generation/insert causes BODY_PARSE_FAILED and unreadable sessions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

{"error":{"code":"BODY_PARSE_FAILED","message":"Invalid JSON in request body.","type":"invalid_request_error"}}

Root Cause

Likely root cause:

  1. Session/thread serialization is not safely escaping some non-ASCII or garbled cwd/workdir/path values.
  2. Image generation results are being stored inline in rollout as huge base64 data:image/png payloads rather than lightweight references.
  3. 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.
RAW_BUFFERClick to expand / collapse

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?

  1. Start a new Codex Desktop session.
  2. Work in a project located on a non-ASCII Windows path. In my case the original project path was under D:\丽爱说.
  3. Generate or insert images in the thread.
  4. Continue chatting after image generation finishes.
  5. 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:

  1. Session/thread serialization is not safely escaping some non-ASCII or garbled cwd/workdir/path values.
  2. Image generation results are being stored inline in rollout as huge base64 data:image/png payloads rather than lightweight references.
  3. 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix Codex Desktop thread corruption after image generation/insert causes BODY_PARSE_FAILED and unreadable sessions