[Windows][MSIX 26.820.7780.0] App cannot start after auto-update: bundled codex.exe relocation fails with ERROR_ENCRYPTION_FAILED (Unable to locate the Codex CLI binary)
Version
OpenAI.Codex 26.820.7780.0 (Microsoft Store / MSIX, installed via winget id 9PLM9XGG6VKS). Previous 26.818.8289.0 worked normally.
Subscription
ChatGPT Plus
Platform
- Windows 11 Home, build 10.0.26200, x64
- MSIX package: OpenAI.Codex_26.820.7780.0_x64__2p2nqsd0c76g0
- Windows-native mode (no WSL;
runCodexInWindowsSubsystemForLinuxnot set)
What issue are you seeing?
After auto-updating from 26.818.8289.0 to 26.820.7780.0, the app can no longer start. A dialog shows:
ChatGPT failed to start.
Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.
The bundled binary is NOT missing — app\resources\codex.exe (307,568,432 bytes) exists and is readable. The real failure happens earlier during the bundled-executable relocation step (copy from WindowsApps into the per-user runtime dir).
Startup log (...\LocalCache\Local\Codex\Logs\...\codex-desktop-*.log):
bundled_executable_relocation_failed
executableName=codex.exe
operation=copy_file
sourceKind=windowsapps
sourcePath=...\WindowsApps\OpenAI.Codex_26.820.7780.0_x64__2p2nqsd0c76g0\app\resources\codex.exe
destinationPath=C:\Users\<user>\AppData\Local\OpenAI\Codex\bin\.staging-...\codex.exe
originalError: errno=-4094, code=UNKNOWN, syscall=copyfile
followed by app_server_connection.transport_connect_failed → Unable to locate the Codex CLI binary → Desktop bootstrap failed to start the main app phase=bootstrap-import-main.
The same startup also fails to relocate the bundled cua_node runtime (copy_directory, node.exe / node_repl.exe / corepack). %LOCALAPPDATA%\OpenAI\Codex\bin ends up with only the old rg.exe; codex.exe never appears.
Steps to reproduce
- Install/auto-update to OpenAI.Codex 26.820.7780.0 via Microsoft Store.
- Launch the app (Windows-native mode,
CODEX_CLI_PATHunset). - Observe the fatal "Unable to locate the Codex CLI binary" dialog.
Independent reproduction of the copy failure
The packaged executables carry the EFS Encrypted / "Application Protected" attribute:
cipher /c <pkg>\app\resources\codex.exe
E codex.exe
Compatibility Level:
Application Protected
A plain copy of the packaged file to a normal user directory fails:
Copy-Item -LiteralPath "$($pkg.InstallLocation)\app\resources\codex.exe" `
-Destination "$env:TEMP\codex-copytest.exe" -Force
# The specified file could not be encrypted. (= ERROR_ENCRYPTION_FAILED, HRESULT 0x80071770)
Reading the file via a byte-stream (File.OpenRead) and writing with File.Create succeeds and produces an ordinary unencrypted file — the data is fine; only the copy path breaks on the EFS/Application Protected source.
What I have tried (and results)
- Fully killed all stale
ChatGPT.exeprocesses. No change. Remove-AppxPackage+ fresh reinstall from msstore (winget). No change — reinstalled package files are stillEncrypted/Application Protected; log is byte-for-byte identical.- Disk space fine, only Windows Defender, no EFS policy / FIPS enabled.
- On this machine creating a NEW encrypted file also fails (
cipher /e→ "The request is not supported"), but this bug reproduces on machines where EFS works normally too, so the primary defect appears to be the app's relocation copy mechanism, not the machine.
Expected behavior
- The app should start using its bundled CLI.
- When relocating EFS/Application Protected package resources to an unencrypted user directory, the copy should succeed (e.g. a
COPY_FILE_ALLOW_DECRYPTED_DESTINATION-equivalent path, or fallback to a buffered read/write stream), and it should surface the underlying Win32 error instead of reporting the CLI as missing. cua_noderuntime should be relocated the same way.
Additional context
- Regression introduced by 26.820.7780.0; 26.818.8289.0 works.
- Related issues: #40700, #40752, #38696, #34764, #32732, #25571, #25220.
- The empty/partial per-user runtime cache under
%LOCALAPPDATA%\OpenAI\Codexis a symptom; the fix belongs in the relocation implementation.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Saw the
bundled_executable_relocation_failedwith the 0x80071770 (ERROR_ENCRYPTION_FAILED) in your log, that's the MSIX codex.exe carrying the EFS "Application Protected" attribute, a plain CopyFile can't copy it to an unencrypted dir. Byte-stream copy works where CopyFile doesn't, so as a workaround you can extract codex.exe that way and point CODEX_CLI_PATH at the copy, it bypasses the relocation step entirely. oh btw, in case it might help that, I built a portable Hermes OTG repo, check it, imo it may be able to help you diagnose and figure out the fix in no time. https://github.com/MilkyWay008/Hermes-OTGConfirmed + two missing pieces: the real Win32 error code behind
UNKNOWN -4094, and whycipher /dis a dead end on Home editionHit the same failure chain on Win11 Home (package
26.820.7780.0, moved toD:\WindowsAppsby a third-party app-relocation tool,Get-AppxDefaultVolume→PackageStorePath: D:\WindowsApps). Adding the concrete error codes and a clean fix path in case it helps the team and other users.1.
UNKNOWN -4094is Win32 6000ERROR_ENCRYPTION_FAILEDNode doesn't map this error code, which is what made this so hard to pin down. One P/Invoke strips the mystery:
The package directory itself is
Directory, Archive, Encrypted; reading and byte-stream copying work (the owner can transparently decrypt), butCopyFilepreserves the encryption attribute onto the destination — and creating an encrypted file fails on Home.2. Decryption is impossible on Home — reinstall is the only path
cipher /eon a fresh file → "the request is not supported" (EFS not available on Home)cipher /d /s:<pkg>(elevated) → "the specified file could not be decrypted" / "access denied" on every entry, attributes unchangedSo no in-place repair exists on Home editions. The working sequence:
Verified afterwards:
InstallLocationon C:, package dir attributes justDirectory, and relocation succeeds.3. Heads-up: two follow-on failures after this one is fixed
From debugging the same machine to a fully working app, two more layers surfaced that readers of this thread will likely hit next:
CODEX_CLI_PATHenv var pointing at a.cmdwrapper makes the app throwspawn EINVAL(CVE-2024-27980 mitigation — Node won't spawn.cmdwithoutshell: true). Deleting the var lets the app use its bundled exe. Details in #40752.~/.codex/state_5.sqlite(migrated by 0.150.0-alpha.8) failsfailed to initialize sqlite state runtimewith no indication of which DB/step failed, despiteintegrity_check: okand all migrations marked success. Deleting it forces a rebuild and fixes startup;sessions/*.jsonltranscripts are unaffected.Suggestion for the app side
The relocation failure currently surfaces as "Unable to locate the Codex CLI binary", pointing users toward PATH/
CODEX_CLI_PATHworkarounds that don't address the real problem. If the installer/stager detected theEncryptedattribute on the package directory (or mapped error 6000) it could emit an actionable message — e.g. "package directory is EFS-encrypted; reinstall on a non-encrypted volume (Settings → Apps → Move, orSet-AppxDefaultVolume -Volume C:\+ reinstall)" — which would have saved most of the 70+ comments across the related threads.Confirmed that this regression still reproduces after updating to the newer Windows AppX package
OpenAI.Codex 26.820.9563.0on Windows x64.Observed locally:
CODEX_CLI_PATHwas unset at the time of failure.Get-AppxPackage OpenAI.Codexreports version26.820.9563.0, statusOk.app/ChatGPT.exe.app\resources\codex.exeexists and is 307,568,432 bytes.app\resources\codex-windows-sandbox-setup.exealso exists.app\resources\bin\codex.exeis absent.ChatGPT failed to start. Unable to locate the Codex CLI binary. Set CODEX_CLI_PATH or ensure the Electron resources include bin/codex.app\resources\codex.exe --versionfrom PowerShell fails withAccess is denied/NativeCommandFailed.codex-cli 0.147.0, so the failure is specific to the updated desktop package/runtime path.app.asarconfirms the packaged startup code still emits theresources include bin/codexlookup error.No permissions, ownership, ACLs, or files under
WindowsAppswere modified. This confirms the startup regression persists in26.820.9563.0, not only26.820.7780.0.I maintain WinBridge Recovery: https://github.com/zemeng5208/winbridge-recovery
This report is a strong match for the Windows-local recovery layer WinBridge is intended to inspect: specifically the WindowsApps/Application Protected (EFS) source -> per-user bundled executable/runtime relocation path, including
codex.exe,cua_node, partial.staging-*directories, and the resulting version/hash/materialization state under the user-local Codex runtime directories.For this failure family, WinBridge can help distinguish and recover local fallout such as:
ERROR_ENCRYPTION_FAILED/UNKNOWN -4094;codex.exe/cua_nodeuser-local runtime copies;Important limitation: WinBridge does not modify or take ownership of
WindowsApps, does not bypass Application Protected/EFS semantics, and cannot make Node/Win32CopyFilecorrectly handle a protected MSIX source if the current Codex build itself is using an incompatible relocation method. If the package source is healthy and every fresh relocation attempt still fails with Win32 6000 /ERROR_ENCRYPTION_FAILED, the durable fix belongs upstream (for example, using a decrypted-destination-capable copy path or buffered read/write fallback).So I would use WinBridge here mainly to repair/validate the local post-failure state and to confirm whether the remaining blocker is still the upstream protected-file copy path. It may help diagnose or recover the local layer, but I would not expect or claim that it guarantees a fix for the underlying 26.820 relocation implementation.