chat open in new window shows something went wrong
Open 💬 6 comments Opened Aug 8, 2026 by lytruby
What version of the Codex App are you using (From “About Codex” dialog)?
Version 26.721.81911
What subscription do you have?
chatgpt pro
What platform is your computer?
_No response_
What issue are you seeing?
<img width="900" height="270" alt="Image" src="https://github.com/user-attachments/assets/8b627add-697f-4dbb-be1c-79c2fcca7465" />
click on 'open in new window' will show this error: something went wrong
What steps can reproduce the bug?
click on 'open in new window' will show this error: something went wrong
What is the expected behavior?
_No response_
Additional information
_No response_
6 Comments
While I don't currently know the root cause for this; I notice that it tends to show up when I have had Codex desktop open for a while (multiple days), with multiple windows open, etc.
My (currently unsubstantiated) theory is that maybe there is some correlation to this and the other issues where Codex doesn't clean up it's helper processes / MCP servers / etc; and that maybe maybe it has hit a soft limit of PIDs or FDs it can launch or similar.
---
Edit: From some further local codex CLI debugging of this, here are some relevant snippets from it's investigation:
And here is a more substantial note from it's conclusion:
---
Edit 2: Investigating deeper, with the context that it often happens after there is a new Desktop app update available, and that maybe the client is caching a reference to the
app.asarand it somehow being changed/replaced/similar related to the update.From the general investigation process:
With it's final conclusion / summary being:
Follow-up with a confirmed root cause and a validated process-local workaround.
Confirmed root cause
This was not PID/FD exhaustion, a corrupt thread, or the running process losing its
app.asarfile. The immediate cause was Electron retaining stale paths for ASAR entries that it had previously extracted into the macOS temporary directory.Inside the live Electron main process:
stat()andreadFileSync()succeeded forapp.asar/webview/index.html.fs.createReadStream()for the same ASAR entry failed withENOENTwhile opening a generated path like:``
text
``/var/folders/.../T/.com.openai.codex.Ie5yNy
app://protocol handler usescreateReadStream(), so thatENOENTbecamenet::ERR_FAILED, causingBrowserWindow.loadURL("app://-/index.html...")to reject and display the hard-coded “Something went wrong…” page.Electron's ASAR
Archive::CopyFileOut()caches each extracted pathname. On a cache hit it returns that pathname without checking whether the temporary file still exists: https://github.com/electron/electron/blob/main/shell/common/asar/archive.cc#L354-L390. Electron's Nodefs.open()wrapper reaches that path throughcopyFileOut(): https://github.com/electron/electron/blob/main/lib/node/asar-fs-wrapper.ts#L1226-L1229.The cached archive object remained healthy and the original packed bytes remained readable. The stale object was the extracted temporary pathname.
Evidence that this affected the whole extracted-file cache
I initially recreated only the missing
index.htmltemp file from the live archive. This changed the symptom from the immediate “Something went wrong…” fallback to a blank/loading renderer, proving that the initial document could now load.Tracing
createReadStream()while reloading then exposed missing temp paths for the main JS bundle, runtime, preload polyfill, CSS, fonts, and progressively loaded route chunks. Recreating each file advanced the renderer to the next import. Later missing dynamic imports caused the React “Oops, an error has occurred” boundary and a secondary exception:In total, 89 distinct missing extracted files were reconstructed manually/through bounded reload passes before installing the general workaround below. This strongly suggests that most or all
.com.openai.codex.*ASAR extraction files had been purged while Electron's in-memoryCopyFileOut()mappings survived.The physical
app.asarhad not been replaced during this process. The running main process still held the same physical device/inode/size as the archive on disk, and the process started after that archive's modification time. A Sparkle update had been downloaded about 28 hours before the first recorded failure, so there is an update-time correlation, but I still do not have evidence identifying Sparkle, macOS cleanup, or another component as the process that deleted the temp files.Validated process-local workaround
Using the Electron main-process Node inspector, I installed a narrowly scoped
fs.createReadStreamwrapper forapp.asar/webview/*. If the underlying ASAR stream fails before yielding data withENOENTfor a.com.openai.codex.*temp path, it:fs.readFileSync()from the retained archive.0600.PassThrough, allowing the originalapp://request to complete without requiring another reload.A controlled test moved one known extracted module aside and fetched its
app://URL. The same request recreated it and returned HTTP 200 with the expected size and identical SHA-256.Afterward, normal interaction caused the patch to repair 28 additional real lazy assets. Current counters are:
With the patch active I successfully tested:
All remained operational. The patch is in-memory only and disappears when Codex restarts.
For local reuse I added idempotent install/status/remove commands to my Electron debugging helper:
The install command enables the loopback Node inspector with
SIGUSR1, injects the wrapper, and leaves the inspector available for continued diagnosis.Standalone installation (no helper required)
This is an unsupported, process-local diagnostic workaround for macOS. The Node inspector grants code execution in Codex's Electron main process, so keep it bound to loopback, do not expose port 9229 to a network, and close it when finished.
The Codex bundle is currently named
ChatGPT.app. Find the Electron main process, enable its built-in Node inspector, and confirm the target is available:If Codex is installed somewhere else, adjust the executable path. There should normally be one exact main-process match; do not signal a renderer or helper process.
Connect using either of these methods:
chrome://inspect/#devices, choose Configure, addlocalhost:9229, then click inspect for the target usually titledelectron/js2c/browser_init.npx --yes chrome-remote-interface --port 9229 inspectand use its JavaScript prompt.Paste this complete expression into the main-process console/REPL:
Retry the failed window/thread. If it is already sitting in the React error boundary from an earlier rejected import, use Try Again or reload that window once. The returned object should show
repairsandretriesSucceededincreasing as missing assets are encountered.Check status at any time:
Remove the patch if needed:
When diagnosis is complete, close the inspector (the installed patch will continue running until removed or Codex exits):
Restarting Codex removes the patch, closes the inspector, and rebuilds Electron's in-memory ASAR extraction cache. In this failure mode, a restart is also the simpler immediate recovery if preserving the broken process for diagnosis is not important.
Suggested fixes
Possible Codex-side fixes:
createReadStream(); read them through the retained archive and return a buffer-backedResponse.app.asar.unpacked.ERR_FAILED (-2).Possible Electron-side defensive fix:
CopyFileOut()cache hit, verify that the cached temporary file still exists and re-extract it if missing.So the remaining unknown is no longer the load failure itself; it is what deletes Electron's extracted
.com.openai.codex.*files during a long-lived Codex session while leaving the process and ASAR cache alive.Additional upstream Electron context after tracing this further:
This appears to be an Electron ASAR cache invariant bug which Codex's custom
app://resource loader happens to expose broadly.The closest prior report is:
It describes an ASAR-backed resource being extracted through
Archive::CopyFileOut(), then becoming unavailable after the OS temp directory is cleared while Electron remains running. That issue concerned a Windows tray icon, but the underlying lifecycle is the same as the.com.openai.codex.*failures observed here. It was closed for inactivity, not by a genericCopyFileOut()fix.Electron's current
Archive::CopyFileOut()implementation stores each extracted file inexternal_files_. On a cache hit it returns the cached pathname immediately, without checking whether the temporary file still exists:This is especially significant in light of this earlier issue:
It was closed with the explicit observation that files under the OS temp directory can be cleaned at any time. In other words, Electron currently combines two incompatible assumptions:
CopyFileOut()may trust the extracted pathname for the lifetime of the cached archive.The relevant archive-cache bug and its fix are:
The fix changed Electron's ASAR archive cache from thread-local to process-wide. That correctly fixed archive/file-handle leaks, but it also means the
Archiveand itsexternal_files_pathname cache can now survive for the entire long-running process.A recent related fix is:
It explicitly describes
CopyFileOut(),external_files_, and the process-wide archive cache. It avoidedCopyFileOut()for one specific packed-ICO call site, but did not change the generic cache-hit behavior or add missing-file recovery.Why Codex encounters this for its whole UI: Electron's Node filesystem wrapper routes
fs.open()througharchive.copyFileOut(), andfs.createReadStream()ultimately uses that wrapped open path. Codex's customapp://handler serves packed webview resources withfs.createReadStream(), so HTML, JS, CSS, fonts, and lazy chunks all become dependent on these extracted temp paths.Electron's own ASAR URL loader does not do that for packed resources; it streams them directly from a duplicate of the archive's retained file handle. That makes the responsibility split fairly clear:
CopyFileOut().The update/replacement theory also has a relevant upstream fix:
It changed packed ASAR reads to use the archive's retained file handle when
app.asaris atomically replaced by an updater or MDM tool. The Codex build examined here contains that retained-handle design, and the live process still held the original archive inode successfully. An update may correlate with removal of temporary extraction files, but replacement ofapp.asaritself was not the direct failure observed here.I could not find a pre-existing open Electron issue or PR covering the exact generic failure:
CopyFileOut()returning a cached extracted pathname after that temporary file has been deleted. The new narrowly scoped upstream report and deterministic reproduction are now available here:The upstream Electron bug is now filed as:
It includes a standalone two-file reproduction independent of Codex:
I verified the reproduction against stock Electron 43.4.0 on macOS 26.6 arm64. The first
fs.createReadStream()extracts and reads the packed ASAR entry; after deleting only that extracted temp copy while Electron remains running,fs.readFileSync()still reads the packed entry successfully, but a secondfs.createReadStream()fails withENOENTfor Electron's stale cached temp pathname.That upstream report cross-links the directly relevant older Electron issues/PRs and this Codex investigation.
Updates from upstream in the electron repo, RE: https://github.com/electron/electron/issues/52804
Context from upstream, the root cause of this issue is fixed, and that will land in electron v45; as is too big to backport to v43/v44:
Looking at the electron release schedule:
That should hit stable around 2026-10-20:
Release | Alpha | Beta | Stable | End of Life | Chromium | Node.js
-- | -- | -- | -- | -- | -- | --
45.0.0 | Aug 27, 2026 | Sep 29, 2026 | ✨Oct 20, 2026✨ | Apr 27, 2027 | M156 | v24.18.1
44.0.0 | Jul 2, 2026 | Jul 28, 2026 | Aug 25, 2026 | Mar 2, 2027 | M152 | v24.18.1
43.0.0 | May 7, 2026 | Jun 2, 2026 | Jun 30, 2026 | Jan 5, 2027 | M150 | v24.17.0