Repository navigation
Description
What happened
codex fails to start because the managed app-server daemon cannot be installed:
Installing daemon from CLI version 0.157.1 into %USERPROFILE%\.codex\packages/app-server-daemon...
Error: Access is denied. (os error 5)
To work without the background server, rerun the same command with --no-daemon (including resume or fork and its arguments).
The install leaves a consistent half-finished state behind, which is the useful clue:
%USERPROFILE%\.codex\packages\app-server-daemon\releases <- empty directory
%USERPROFILE%\.codex\packages\app-server-daemon\install.lock <- 0 bytes
So directory creation and lock-file creation both succeed. The failure happens after that, and it is not a plain permission problem.
Root cause
prepare_install_windows.rs (select_release) does not create the current junction directly. On the cold path it creates a temp dir, creates a real directory named current inside it, then converts that existing directory into a mount-point junction via DeviceIoControl(..., FSCTL_SET_REPARSE_POINT, ...), and finally renames it into place.
That conversion is what returns ERROR_ACCESS_DENIED. Creating a new junction on the same machine, in the same directory, works fine:
# both succeed, in .codex\packages and in %TEMP%
mklink /J link target
New-Item -ItemType Junction -Path link -Target targetOnly the "open an existing directory with GENERIC_WRITE + FILE_FLAG_OPEN_REPARSE_POINT and set a reparse point on it" path is blocked. On this machine CodexSandboxService.OpenAI.Codex is running, and a filter driver blocking reparse-point writes (a standard junction-escape mitigation) would produce exactly this. If that is Codex's own sandbox driver, Codex is blocking its own daemon install.
Reproduction
Remove-Item "$env:USERPROFILE\.codex\packages\app-server-daemon" -Recurse -Force
codex app-server daemon start # -> Error: Access is denied. (os error 5)codex app-server daemon start reproduces this without a tty, which is much easier to automate than the TUI path (the TUI exits with stdin is not a terminal before reaching the install step).
Ruled out
Each of these was tested and eliminated, so please don't re-litigate them:
| Hypothesis | Evidence against |
|---|---|
File lock / stale install.lock |
install.lock opens exclusively; no process holds it |
| Missing write permission | Manually copying the 322 MB codex.exe into the target path succeeds |
ACL on .codex |
The explicit CodexSandboxUsers: ReadAndExecute ACE looks guilty but isn't — the user has FullControl at every level, and that group only contains the two Codex sandbox accounts |
| Directory location | Pointing CODEX_HOME at a brand-new %TEMP% dir fails identically |
| Insufficient privilege | Codex refuses to run elevated: "start the Windows daemon from a non-elevated terminal" |
| Antivirus | Defender service not running (Get-MpPreference returns 0x800106ba) |
| Job Object (#44503) | Launching via WMI to escape the job gives the same os error 5; a real job problem reports a different, explicit error |
| Version regression (#48043) | 0.156.1 fails identically. Downgrading does not help here, so this is a distinct bug from #48043 |
| Disk space | 19.4 GiB free |
RUST_LOG=trace only yields a backtrace with all-<unknown> symbols, which is why the source reading was necessary.
Workaround
Building the layout by hand makes the installer take the warm path and skip the conversion entirely. The daemon then starts and runs normally:
$root = "$env:USERPROFILE\.codex\packages\app-server-daemon"
$src = "<npm global>\@openai\codex\node_modules\@openai\codex-win32-x64\vendor\x86_64-pc-windows-msvc\bin\codex.exe"
$rel = "$root\releases\0.157.1-x86_64-pc-windows-msvc"
New-Item -ItemType Directory -Force -Path "$rel\bin"
Copy-Item $src "$rel\bin\codex.exe" -Force
cmd /c "mklink /J `"$root\current`" `"$rel`""
codex app-server daemon startResult:
{"status":"running","backend":"pid","managedCodexVersion":"0.157.1","cliVersion":"0.157.1","appServerVersion":"0.157.1"}codex doctor then reports ✓ app-server running. The layout contract came from managed_install.rs: current\bin\codex.exe (packaged) with current\codex.exe as the legacy fallback, and the release directory must be <three-part version>-<target triple>.
This has to be redone after every CLI upgrade, since a version mismatch triggers the updater and walks back into the same code path.
Suggested fix
Treat the reparse-point conversion as best-effort: if FSCTL_SET_REPARSE_POINT fails with ERROR_ACCESS_DENIED, fall back to creating the junction directly (which works even when converting does not), or fall back to a plain directory / the legacy standalone layout instead of failing the whole install. An unavailable junction should degrade to ephemeral mode rather than block startup.
Environment
- Windows 10 Pro/Home 10.0.19045 x64
- codex-cli 0.157.1 (also reproduced on 0.156.1), npm global install
- Terminal: VS Code integrated terminal, non-elevated
[windows] sandbox = "elevated"in config.toml;codex doctorreports sandbox provisioning complete and 0 failuresCodexSandboxService.OpenAI.Codexrunning
Related but distinct: #48043 (same subsystem, but downgrading fixes that one and not this), #44503 (Job Object check, different error message).
Activity
github-actions commentedon Sep 28, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
shgef commentedon Sep 28, 2026
Correction to the workaround above: copying only
bin\codex.exeis not sufficient.Doing that does let the daemon start, and
codex doctorreportsapp-server runningwith 0 failures — but actual use then fails withcodex-code-mode-host.exemissing, and even read-only commands cannot start. The managed release directory has to mirror the whole vendor tree (45 files, ~425 MB), not just the main binary:So the copy step should mirror the entire vendor directory into the release directory, with the daemon stopped first:
Worth noting for the fix itself:
daemon startsucceeding anddoctorshowing all-green are not sufficient health signals here. Neither one validates that the managed release is complete, so a partially-populated release directory looks perfectly healthy right up until a tool invocation fails. A manifest or completeness check on the release directory would catch that.francis1104 commentedon Sep 28, 2026
Additional confirmation from another Windows standalone installation (Codex CLI 0.157.1):
I hit the same daemon install failure:
The standalone 0.157.1 release itself was complete. These all existed:
I then manually mirrored the complete standalone release into:
and created the
currentjunction directly in a normal, non-elevated PowerShell:That succeeded immediately.
After that:
codex app-server daemon startreturned successfully:
{"status":"started","backend":"pid","managedCodexVersion":"0.157.1","cliVersion":"0.157.1","appServerVersion":"0.157.1"}And
codex doctorreported:with:
So this independently confirms the same pattern described here: the Codex-managed daemon installation path fails with
os error 5, while creating the junction directly with PowerShell works on the same machine, and the daemon runs normally once the expected release layout is constructed manually.中文补充:
另一台 Windows standalone 0.157.1 环境也复现了完全相同的
Access is denied (os error 5)。确认 standalone release 本身完整后,手工复制完整 release 到app-server-daemon\releases\0.157.1-x86_64-pc-windows-msvc,再用 PowerShell 的New-Item -ItemType Junction直接创建currentjunction,可以立即成功。随后
codex app-server daemon start正常启动,codex doctor显示0 warn · 0 fail。这进一步说明问题不是普通文件写权限或 release 内容损坏,而是 Codex 自己的 Windows daemon/junction 安装路径。rajumb0232 commentedon Sep 29, 2026
After the latest Codex CLI update on Windows, running
codexfailed immediately withError: Access is denied. (os error 5)and suggested--no-daemon. I reproduced it from two separate repositories. Reinstalling my previous Codex version restored normal startup with plaincodex.The
--no-daemonworkaround launched Codex, but touchpad movement then inserted[M#...]sequences into the prompt. I’m treating that as a separate TUI issue. I can share the exact working and failing version numbers once confirmed.kge-lab commentedon Sep 29, 2026
Additional reproduction on Windows 11 x64 with PowerShell and Codex CLI 0.159.0.
Command:
Actual result:
Workaround:
The workaround works successfully, which confirms that the failure is limited to background daemon startup. The normal interactive resume path is blocked on 0.159.0 as well.
rajumb0232 commentedon Oct 6, 2026
Additional report on 2026-10-06: normal Codex CLI startup is still blocked on Windows with codex-cli 0.160.1.
Environment: Windows, PowerShell. Exact Windows build, installation method, and terminal elevation status have not been collected.
Observed output (working directory omitted):
This occurred immediately after updating. The same error also occurred on the previous installed version, whose version number is not available.
Expected: plain
codexstarts normally with the background server enabled.Actual: startup exits with the error above, blocking use.
The user is choosing to roll back rather than bypass the background server. No successful rollback or
--no-daemontest has been reported for this occurrence.The error text matches this issue, but without diagnostics we cannot confirm that the failing operation is the same reparse-point operation described in the original report. Please investigate whether the fix for this closed issue covers normal CLI startup on 0.160.1, or track this as a separate daemon startup failure if appropriate.
RazvanVC commentedon Oct 8, 2026
Windows daemon installation: confirmed recovery on 0.160.0 and successful upgrade to 0.161.0
Posting an anonymized troubleshooting report from a Windows 11 Enterprise x64 machine (build 26100), using Windows PowerShell and the standalone Codex CLI installer. This appears related to #48853, but we did not trace the failing Windows API and cannot confirm the same underlying cause.
Symptoms
Normal
codexstartup failed with:codex --no-daemonworked. Running the foregroundcodex app-serveralso started the process. That command expects JSON-RPC, so typing ordinary sentences into it caused JSON deserialization errors; those were not evidence of the original startup failure.The more useful reproduction was:
Findings
codex doctorreported a consistent installation, configured authentication, healthy state databases, and successful HTTP/WebSocket checks. These checks did not establish that daemon installation was healthy..staging.*directories accumulated under%USERPROFILE%\.codex\packages\app-server-daemon\releases.bin\codex-code-mode-host.exewas the only missing source file. A manual copy of that source file to a separate diagnostic directory succeeded. This is a diagnostic clue, not proof that the missing file caused the original error.What worked
The incomplete daemon staging directories were moved to a backup outside the
releasesdirectory. Then the official PowerShell installer was invoked for the daemon package separately, targeting 0.160.0, instead of relying on the CLI's failing automatic daemon installation step.The installer source at https://chatgpt.com/codex/install.ps1 (redirecting to releases.openai.com) supported both
-ReleaseandCODEX_INSTALL_DAEMON_ONLY=1at the time of testing. The daemon-only environment variable is an implementation detail observed in the installer, not a promise of a stable public interface.The essential installer invocation was equivalent to:
Execution detail: the agent session encountered a Schannel download error, so it used Node's TLS implementation as the download transport while retaining the official installer's package/checksum checks. The equivalent plain PowerShell snippet above was not separately tested end-to-end in that session.
After installation, the daemon's
currentjunction targeted the complete 0.160.0 release. The daemon executable reported 0.160.0, and the previously missing helper's SHA-256 matched the standalone source package. The user then confirmed that normalcodexstartup worked without--no-daemon.Confirmed upgrade to 0.161.0
Both CLI and daemon packages were subsequently installed at 0.161.0 using the same installer approach. A restart from the agent sandbox was blocked by private-directory validation after temporary access grants were added. The user then ran a narrowly scoped cleanup/restart script from their normal PowerShell. It removed only those two maintenance-related access entries, restarted the daemon, and checked the CLI and running daemon versions.
The user supplied this successful restart result on October 8, 2026 (unnecessary identifiers and paths omitted):
{ "status": "restarted", "backend": "pid", "managedCodexVersion": "0.161.0", "cliVersion": "0.161.0", "appServerVersion": "0.161.0" }A subsequent normal
codex -C <project-directory>launch established a session and reported token usage, without the original access-denied error. The transcript ended withDisconnected from this task. Any running work continues.and a resume command. This confirms recovery from the daemon installation/startup failure on 0.161.0; it does not establish why that session disconnected or prove that every CLI feature was tested.The private-directory validation during agent-driven maintenance was a separate observation. Avoid blanket ACL resets or broad antivirus exclusions based solely on
os error 5. No credentials, full diagnostic logs, company identifiers, or user-specific paths are included here.It would help if the automatic daemon installer reported the failing file or operation, and if maintainers could confirm a supported repair command for this incomplete-package state.
etraut-openai commentedon Oct 8, 2026
@rajumb0232 and @RazvanVC, thanks for the additional details. We have a fix in place for this issue. It will be included in the 0.162.0 release, which should be published within the next 12 hours.
WoozChucky commentedon Oct 10, 2026
Just updated to 0.162.1 and I'm getting the same error I believe. Are you sure this fix works ?
etraut-openai commentedon Oct 10, 2026
@WoozChucky, there are potentially multiple causes of an "Access is denied" error. 0.162.1 fixed the most common. It's possible you're hitting a different one. Please open a new bug report. After you see the failure, relaunch with
--no-daemonand use/feedbackto upload your logs, then include the session ID in the bug report. That will help us further diagnose the cause of the "Access is denied" error you're seeing on your system.