Windows Codex Desktop becomes unstartable after adding a second folder to an existing project
What version of the Codex App are you using?
26.721.3404.0
What subscription do you have?
ChatGPT Business
What platform is your computer?
Microsoft Windows 11 Pro, version 10.0.26200, build 26200, x64
What issue are you seeing?
Codex Desktop becomes stuck on the generic “An error occurred” screen after adding a second local folder to an existing project. After that, restarting the app returns to the same error screen, so the app is effectively unstartable until the saved project state is repaired manually.
The project name contained a special character (&), but that character is not the cause: keeping the same renamed project name and removing only the second root restores normal startup.
Both folders exist on the same local C: drive. Both are normal directories, not links or junctions. The primary folder is a Git repository. The secondary folder is a separate runtime/deployment directory and is not intended to be treated as a Git repository.
What steps can reproduce the bug?
- Open an existing saved local project whose primary root is
<PRIMARY_GIT_REPO>. - Rename the project to a different display name containing
&. - Add a second existing local folder to the same project:
<SECONDARY_RUNTIME_FOLDER>. - Codex immediately shows the generic “An error occurred” screen.
- Fully close and restart Codex.
- The same error screen appears again and the app cannot be used.
Reproducibility
Reproduced twice with the same project and folder pair.
Isolation result
The saved state remains valid JSON. After the failed operation, the project entry contains two root paths:
{
"name": "<RENAMED_PROJECT>",
"rootPaths": [
"<PRIMARY_GIT_REPO>",
"<SECONDARY_RUNTIME_FOLDER>"
]
}
If Codex is fully closed and the second root is removed from both of these files:
%USERPROFILE%\.codex\.codex-global-state.json
%USERPROFILE%\.codex\.codex-global-state.json.bak
then Codex starts normally again, the project history is preserved, and the renamed display name can remain unchanged.
This strongly suggests that the trigger is the project becoming multi-root, not the display name and not malformed JSON.
Expected behavior
Codex should either:
- open the project normally with both folders attached, or
- reject an unsupported folder combination with a recoverable validation message.
It should not persist a state that makes the entire desktop app unstartable.
Workaround
- Fully quit Codex.
- Back up
.codex-global-state.jsonand.codex-global-state.json.bak. - Remove only the second project root from the affected project in both files.
- Start Codex again.
Additional information
- Primary folder: exists, normal directory, Git repository
- Secondary folder: exists, normal runtime/deployment directory
- Both folders are on the same
C:drive - No symlink/junction/reparse-point attributes
- No Crashpad reports were created for this failure
- The visible error is an in-app generic error screen, not a native process crash dialog
- Related feature request: #27943
- Possibly related Windows path/state handling issue: #28192
23 Comments
Confirmed on the same Store build (
26.721.3404.0) with an additional deterministic repro and renderer diagnostics.Environment for this repro:
19045OpenAI.Codex_26.721.3404.0_x64__2p2nqsd0c76g0Additional repro path:
selected-projectto an existing single-root project allowed Desktop to launch.rootPathsto one entry in both global-state files allowed Desktop to launch with the same project still selected; the older task was usable and fresh logs contained no new fatal error.Exact renderer log signature:
The repeated component stack begins at:
A read-only inspection of the packaged renderer suggests a possible cause (hypothesis, not confirmed source-level diagnosis): the multi-root filtering path calls a
path-browserifyPOSIXrelative()operation on normalized strings shaped likewin32:c:/.... With two roots, resolution can fall back toprocess.cwd(), but the sandboxed renderer has no Nodeprocessglobal. With one root, the pairwise comparison short-circuits before that branch.This also confirms the bug is not limited to a particular second-folder type, special character, or malformed JSON: the transition from one saved root to two is the shared trigger.
I initially filed #35061 before seeing this earlier report; it contains the longer diagnostic write-up and will be closed as a duplicate of this issue.
+1,This is a very serious bug. I strongly suspect Codex was released without testing.
Codex版本:26.721.30844
电脑运行版本:Windows 11 家庭版 中文版 25H2
问题描述:在已有项目任务中添加新的文件夹项目后,Codex出现崩溃。
问题现象:
<img width="958" height="613" alt="Image" src="https://github.com/user-attachments/assets/231332c9-db27-4a05-a822-c6e12d3ead89" />
暂时解决方案:回退用户下的.codex中的.codex-global-state.json、.codex-global-state.json.bak的rootPaths中读取的项目路径
<img width="653" height="230" alt="Image" src="https://github.com/user-attachments/assets/03c46350-d8c7-476e-ba35-a5b535df320b" />
I can confirm this issue.
I updated to the latest Windows desktop build today, tried the new ability to add a second folder to an existing project, and immediately hit the same full-screen "An error occurred" page. After that, every restart returned to the same screen, making the app unusable.
The workaround described in this issue is effective. After removing the second entry from
rootPathsin both.codex-global-state.jsonand.codex-global-state.json.bak, the application started normally again and my existing project history was preserved.Thank you to everyone who investigated the root cause and shared the workaround. Looking forward to seeing multi-folder projects become stable on Windows, since it's a very useful feature for real-world development workflows.
I encountered the same issue, and following the original poster’s workaround resolved it successfully.
A bug this serious, and this easy to reproduce… and they still shipped it?
It was inevitable given the app's daily releases.
真的不敢想象,这么容易出现的bug,竟然没有被测
Additional confirmation: nested roots and an existing project are not required. I reproduced this through the advertised multi-source flow while creating a brand-new project.
Environment
26.721.3404.0codex@26.721.3084410.0.26200Ok(Store-signed MSIX)Reproduction variant
Oops, an error has occurredfallback. Subsequent launches return to the same screen because the new project remains selected.Both folders in this reproduction were:
C:driveThe saved state remained valid JSON and contained the expected two-root shape:
Renderer evidence
The fresh Sentry scope repeatedly recorded:
The router also warned that the matched leaf route at
/had no element/component and would render an empty outlet.A/B recovery result
With Codex fully closed, I backed up the global state, removed only the newly created two-root project from
local-projects/project-order, and restored a known one-root project asselected-project.After relaunch:
Status: Okerrors: 0No reinstall, package reset, cache clear, or authentication reset was needed.
This broadens the trigger from “adding a second folder to an existing project” to creating any selected Windows project with multiple source folders, including two unrelated non-Git directories. Since multiple sources are exposed as a supported project feature, the app should validate/recover this state rather than persist a project that prevents the entire shell from starting.
I performed a read-only inspection of the packaged renderer from build
26.721.3404.0. This appears to identify the concrete failure path behind the existingprocess is not definedrenderer error.The multi-root filtering logic calls the POSIX implementation of
relative()on normalized Windows identifiers, effectively:For Windows roots, the normalization result is shaped like:
That value does not begin with
/, sopath-browserify's POSIXresolve()treats it as relative and falls back toprocess.cwd(). In the sandboxed renderer there is no Nodeprocessglobal, producing:This also explains the one-root/two-root A/B behavior: with one root, the self-comparison short-circuits before
relative()is called; with two distinct roots, the comparison reaches that branch and the renderer crashes.I reproduced the same behavior with an isolated equivalent of the packaged logic: one normalized root completes normally, while two distinct
win32:roots throwReferenceError: process is not definedwhen evaluated without aprocessglobal.The fix should avoid passing
win32:identifiers to the POSIXrelative()implementation, or otherwise ensure the path representation is truly absolute before resolution. A platform-aware path comparison would likely be safer.No application bundle or private paths are attached here.
I can confirm that this is still reproducible in the newer Microsoft Store package
26.721.3996.0(after the originally reported26.721.3404.0build).The packaged renderer follows the same failure path described above:
path.posix.relative(normalize(rootA), normalize(rootB)).win32:/mnt/c/....path-browserifyfalls back toprocess.cwd().processglobal, so selecting any project with two distinct roots throwsReferenceError: process is not defined.A renderer-side fix should avoid passing scheme-prefixed path identities to
path.posix.relative. The safer approach is to parse the normalized scheme/drive and compare path segments only when the roots share the same origin; roots on different drives should be treated as unrelated. A smaller fix would first convert the normalized identity to a genuinely absolute POSIX sentinel path before callingrelative, but the drive/scheme-aware comparison is less error-prone.Suggested regression matrix (with
globalThis.processabsent, matching the sandboxed renderer):For each case, selecting/rendering the project and its file-search labels should not throw, and distinct roots should remain distinguishable.
I checked the public
openai/codextree, but the Desktop React/Electron renderer containing this helper is not present there. The repository's contribution policy also says external PRs require a maintainer invitation. If a maintainer can point me to the relevant source location and invite a targeted contribution, I am happy to submit the focused fix and regression tests.Confirmed on the newer Microsoft Store stable package
OpenAI.Codex_26.721.3996.0_x64__2p2nqsd0c76g0on Windows 11 x64 (build 22621).The selected local project had exactly two distinct roots. On every launch, the primary window failed in
AppRouteswith:The same error was also emitted for
hotkeyWindowHomeandhotkeyWindowThread.Additional A/B results:
Ok.OpenAI.CodexBeta_26.715.3651.0starts normally on the same machine and reads the sameCODEX_HOME; its logs contain no equivalent error boundary.ok, confirming that this is a renderer regression rather than local data corruption.No private paths, project names, account details, or logs containing user content are attached.
Additional confirmation from a Windows 11 system on the newer Microsoft Store build 26.721.3996.0.
Environment
OpenAI.Codex_26.721.3996.0_x64__2p2nqsd0c76g00.146.0-alpha.3.1Trigger and evidence
The selected local project was the only project in the saved state with exactly two unrelated Windows roots. Adding the second folder was followed by the full-page error. Across three launches, the renderer emitted the same failure seven times:
The surrounding
thread/listandthread/readcalls completed witherrorCode=null. Read-only integrity checks also passed:state_5.sqlite:PRAGMA quick_check = oklogs_2.sqlite:PRAGMA quick_check = oksession_index.jsonl: 164 valid JSON lines, 0 invalidThis rules out chat/session database corruption on this machine.
A read-only inspection and isolated execution of the packaged renderer path reproduced the same exception. The multi-root comparison calls the POSIX
relative()implementation with normalized Windows identifiers shaped likewin32:e:/.... Because those identifiers are not POSIX-absolute, the bundled path implementation falls back toprocess.cwd(); the sandboxed renderer has no Nodeprocessglobal. With one root, the pairwise comparison short-circuits before reaching that branch.Validated recovery / workaround
%USERPROFILE%\.codex\.codex-global-state.json%USERPROFILE%\.codex\.codex-global-state.json.baklocal-projects(the project referenced byselected-project).rootPathsfrom two entries to one by preserving the original first root and removing the newly added second root.Do not delete chats, sessions, SQLite databases, skills, configuration, authentication, or project files. Reinstalling alone is unlikely to help because the persisted multi-root state can survive the reinstall.
After changing only those two
rootPathsarrays, both files remained valid and the semantic diff contained no other change. The same app build then started normally, fresh logs contained 0process is not definederrors, chat list/read operations succeeded, and the user confirmed the UI was restored. Existing chat history and project files were preserved.No private paths, project names, account details, or conversation IDs are included here.
Confirmed on a newer Windows build with a larger multi-root project.
Environment
26.721.3996.028020requestSandboxWritableRootCount=9)Reproduction and isolation
thread/readsucceeds.This reproduces with both:
subagent; andTherefore the saved conversation content/source is not the trigger.
I also repaired a missing local
refs/remotes/origin/HEADpointer in the primary repository and confirmed all configured directories exist. The renderer failure was unchanged, so Git default-branch discovery is not the cause.The deterministic log sequence is:
The task route then falls back to the home/previous conversation. This happened on each controlled open.
The project and task history remain intact. Archiving the original task and creating a clean replacement does not help while the project retains multiple roots.
I am applying the same recovery described in this issue: preserve backups of the session/global state, then reduce the affected project's
rootPathsto only its primary Git repository in both.codex-global-state.jsonand its.bakcopy while Codex is closed.This confirms the multi-root renderer regression persists in
26.721.3996.0, and adds the exact frontend exception signature.<img width="1980" height="1092" alt="Image" src="https://github.com/user-attachments/assets/767bfb60-cefb-4a39-989f-24eec59d9a9a" />
Having the same issue.
Removed at the user's request.
FIX
Close the app
Go to C:\Users/[username]/.codex
Locate .codex-global-state and .codex-global-state.json.bak and got to an editor
Find the paths of the projects you added, edit them, delete the added project path in all keys, save
Additional deterministic recurrence on Microsoft Store build
26.721.3996.0, with evidence from the persisted migration state.Reproduction variant
T0.AppRouteserror boundary atT0 + 273 ms:This has now recurred three times on the same affected build, including after a successful minimal state repair and clean relaunch.
Unfinished migration shape
Both global-state copies were identical, valid JSON. In addition to the selected project's two-entry
rootPaths, this recurrence left exactly one matching unfinished migration:A prior recurrence on this machine persisted the two-root project with no pending assignment/atom, so both interrupted and apparently completed migration shapes can strand the renderer.
Verified recovery
With Desktop fully stopped:
.codex-global-state.jsonand.codex-global-state.json.bak.rootPathsto its original first root.pendingCoreUpdateassignment and its matching workspace atom.No sessions, SQLite databases, configuration, authentication, project files, or unrelated thread records were changed. After relaunch, all Desktop processes were responsive; the fresh log contained 71 successful
response_routedentries witherrorCode=nulland zero newprocess is not definederrors.This suggests the UI should both avoid the renderer's
process.cwd()path and make the project-source migration transactional/fail-safe so a renderer exception cannot persist an unstartable selected project.All project names, paths, thread identifiers, and account details are redacted.
Add a second Project folder in 26.721.41059; it seems not to crash.
Encountered a similar problem.
Version: 26.721.41059
Platform:Windows 11
When creating a new project with a Chinese name and selecting two ASCII-only directories as project roots, Codex immediately showed the same error message.
This seems to be related to multi-root projects on Windows.
Fixed in new update, but... about shows '26.721.41059'.
In %USERPROFILE%.codex.codex-global-state.json, locate the affected project under local-projects, find the additional source directory you added in rootPaths, and remove only that directory entry. Then restart ChatGPT.
Confirmed fixed in Codex Desktop
26.721.11231.0, so I’m closing this issue.Using the same project and folder pair from the original report, I added the second folder again, saved the project, fully restarted Codex, and the app reopened normally with both folders still attached.
I also compared the packaged renderer.
In the affected build, the multi-root filtering logic was equivalent to:
For the normalized Windows paths used by the renderer, this could reach
process.cwd()throughpath-browserify. Because the sandboxed renderer does not expose the Node.jsprocessglobal, it failed with:In
26.721.11231.0, that logic appears to have been replaced with normalized path-prefix comparison equivalent to:This removes the observed
path.posix.relative()→process.cwd()failure path.Verified fixed in
26.721.11231.0.