[Windows Desktop] Opening generated files can trigger uncaught write EPIPE in custom json_stdin handler
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
What version of the Codex App are you using?
- Codex Desktop Microsoft Store package:
26.820.7780.0 - Bundled app release observed locally:
26.820.60940 - Chromium runtime:
151.0.7922.170 - Node runtime:
24.14.0
What platform is your computer?
Windows 10 22H2, build 19045, x64.
What issue are you seeing?
Codex Desktop repeatedly displays a blocking Electron main-process modal:
A JavaScript error occurred in the main process
Uncaught Exception:
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:159:15)
at writeGeneric (node:internal/stream_base_commons:150:3)
at Socket._writeGeneric (node:net:966:11)
at Socket._write (node:net:978:8)
at writeOrBuffer (node:internal/streams/writable:570:12)
at _write (node:internal/streams/writable:499:10)
at Writable.end (node:internal/streams/writable:821:17)
at Socket.end (node:net:737:31)
at .../app.asar/.vite/build/main-TomazcfO.js:291:4276
at new Promise (<anonymous>)
The modal blocks normal work until dismissed. It occurred twice in one session, approximately 32 minutes apart.
Steps that likely reproduce the bug
- Ask Codex to generate files, such as SVG files.
- From a task result/file card, use an open/right-click action to open two generated SVG files in an external application such as VS Code.
- The external handler exits or closes its standard input quickly.
- Codex displays the uncaught
write EPIPEmain-process modal.
The failure is recurrent but timing-sensitive.
Packaged-build evidence
Inspection of the installed app bundle maps the reported frame at main-TomazcfO.js:291:4276 to a shared external-command launcher. That launcher:
- creates a child process inside
new Promise(...); - registers an error handler on
child.stdin; - immediately calls
child.stdin.end(payload)when stdin data is supplied.
The observed caller that supplies stdin in this path is the custom file-handler branch of the open-in-targets service, using input: "json_stdin".
This evidence suggests a race in which an external file handler exits or closes its pipe before the asynchronous stdin.end() write completes. The resulting EPIPE still reaches Electron's main-process uncaught-exception dialog. This is an inference from the packaged build and reproduction timing, not yet a deterministic minimal reproducer.
This appears distinct from the currently reported IPC/Git paths:
- #35985: browser-sidebar IPC client lifecycle
- #38360: recurring Windows modal with browser-pipe evidence
- #39228: macOS IPC client churn, which explicitly notes that the final unhandled writer may be a separate socket path
Searches for EPIPE "open-in-targets" and EPIPE json_stdin in this repository returned no existing issue.
Expected behavior
- Opening generated files in VS Code or another external application must not display a main-process exception.
- A child process closing stdin early should be handled as an external-handler lifecycle failure.
- Expected
EPIPE/EOFduring handler teardown should not escape to Electron's uncaught-exception dialog. - Users should not need to avoid opening generated artifacts from Codex.
Suggested repair direction
Please audit the open-in-targets/custom json_stdin command runner:
- retain an error listener for the entire writable lifetime;
- handle both completion and failure around
stdin.end(payload); - make child exit, stdin error, and close resolution idempotent;
- treat
stdin.destroyed,stdin.writable, andstdin.writableEndedonly as useful preconditions, not as a complete race fix; - suppress expected
EPIPE/EOFduring handler teardown from the process-level uncaught-exception path; - add a regression test in which the target process exits before or during the stdin write.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the shared external-command launcher and the open-in-targets custom json_stdin branch corresponding to main-TomazcfO.js:291:4276. Start by tracing stdin.end(payload) and child-process lifecycle handling, then add a regression test where the target exits before or during the stdin write. Done means expected EPIPE/EOF teardown does not reach Electron's uncaught-exception dialog.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, javascript, node.js
- Domain
- desktop, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100