Skip to content

[BUG] Codex CLI 0.157.0 fails to start on Windows with daemon privilege error (0.156.1 works) #48043

Open

Description

@SingCJ

What version of Codex CLI is running?

0.157.0

What subscription do you have?

PLUS

Which model were you using?

No response

What platform is your computer?

Windows

What terminal emulator and version are you using (if applicable)?

No response

Codex doctor report

What issue are you seeing?

Description

Codex CLI 0.157.0 fails to start on Windows with the following error:

Error: start the Windows daemon from a non-elevated terminal; shared clients must not inherit administrator privileges
To work without the background server, rerun the same command with --no-daemon (including resume or fork and its arguments).

Downgrading to version 0.156.1 resolves the issue.

What steps can reproduce the bug?

Steps to Reproduce

  1. Install Codex CLI 0.157.0 on Windows:
    npm install -g @openai/codex@0.157.0
  2. Launch Codex CLI:
    codex
  3. Observe the daemon privilege error.

What is the expected behavior?

Expected Behavior

Codex CLI should start normally, as it does with version 0.156.1.

Actual Behavior

Codex CLI 0.157.0 fails to start and displays an error about launching the Windows daemon from a non-elevated terminal.

Additional information

Workaround

Downgrading to version 0.156.1 restores normal operation:

npm install -g @openai/codex@0.156.1

Environment

  • OS: Windows
  • Affected version: Codex CLI 0.157.0
  • Last known working version: Codex CLI 0.156.1

Additional Information

This appears to be a regression introduced in version 0.157.0, as the previous version works in the same environment.

Activity

  1. added
    bug
    on Sep 25, 2026
  2. added
    CLI
    windows-os
    app-server
    on Sep 25, 2026
  3. sanukhandev commented on Sep 25, 2026

    @sanukhandev

    Same here,

    After updating Codex CLI through PowerShell on Windows 11 64-bit, running codex attempts to install the background daemon but fails with an Access is denied error.

    Codex still works when using --no-daemon, but performance is noticeably slower compared with the previous version/setup.

    Environment

    • OS: Windows 11 64-bit
    • Shell: PowerShell
    • Codex CLI version: 0.157.0
    • Installation/Update method: Updated through PowerShell
    • Working directory example:

    Steps to Reproduce

    1. Update Codex CLI through PowerShell.
    2. Open PowerShell.
    3. Navigate to a project directory.
    4. Run:
    codex

    Actual Result

    Codex attempts to install the app-server daemon:

    Installing daemon from CLI version 0.157.0 into C:\Users\<USER>\.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).
    

    Full console output:

    PS C:\Users\Sanu> codex
    Installing daemon from CLI version 0.157.0 into C:\Users\Sanu.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).
    PS C:\Users\Sanu
    

    Workaround

    Running Codex with the daemon disabled works:

    codex --no-daemon

    However, Codex feels noticeably slower when running with --no-daemon compared with the previous behavior using the background server.

    Expected Result

    Running:

    codex

    should successfully install/start the background daemon under:

    C:\Users\Sanu\.codex\packages\app-server-daemon
    

    without requiring elevated/admin permissions or returning os error 5.

    Impact

    • Codex cannot use the background daemon.
    • --no-daemon is required as a workaround.
    • Performance appears slower without the daemon.
    • This started after updating the Codex CLI.

    Additional Notes

    It may be related to Windows permissions, file locking, antivirus/Windows Defender protection, or the daemon installation/update process attempting to replace files that are currently in use.

    It would be useful if the CLI could provide additional diagnostics indicating which exact file or operation is returning Access is denied.

  4. thuanhuynhh commented on Sep 25, 2026

    @thuanhuynhh

    same issue when used it with Orca ADE

  5. sanukhandev commented on Sep 25, 2026

    @sanukhandev

    I just downgraded to 0.156.1 now its working

  6. ArielBADs commented on Sep 25, 2026

    @ArielBADs

    I just downgraded to 0.156.1 now its working

    I did the same thing.

  7. terciosilas commented on Sep 25, 2026

    @terciosilas

    Também tivemos esse problema no Windows com Codex CLI 0.157.0, instalado via npm, em um PowerShell aberto como Administrador (UAC habilitado).

    Ao iniciar codex, foi apresentada a mensagem:

    start the Windows daemon from a non-elevated terminal; shared clients must not inherit administrator privileges
    

    A solução temporária aplicada foi configurar:

    [features]
    daemon_auto_start = false

    Isso permitiu usar o CLI sem o daemon compartilhado. A versão 0.157.0 e a configuração acima foram conferidas neste ambiente. Não testamos downgrade.

    Entendemos que a restrição de privilégios pode ser intencional. O problema de experiência de uso é a inicialização do CLI ser bloqueada quando o terminal está elevado. Seria útil oferecer uma alternativa explícita para continuar sem daemon, ou orientar a abertura de uma sessão não elevada, preservando a separação de privilégios.

    Relato acrescentado a pedido do usuário afetado.

  8. BIIOSs commented on Sep 25, 2026

    @BIIOSs

    Could someone tell me how to copy and paste a prompt into Codex? I can't paste it using right-click or Ctrl+V; it won't copy, and I get an error.

  9. tqz commented on Sep 25, 2026

    @tqz

    For others who got here looking for a fix: Same error on Linux. Reverting to 0.156.1 fixes it.

  10. TCOTC commented on Sep 25, 2026

    @TCOTC

    Adding a distinct variant of this report where the suggested workaround is not achievable at all: this machine has UAC disabled, so there is no non-elevated session to start Codex from. Every process — including explorer.exe and any terminal opened from the Start menu or desktop — already carries a full administrator token.

    Environment

    • codex-cli 0.157.0, standalone Windows install (%LOCALAPPDATA%\Programs\OpenAI\Codex\bin\codex.exe)
    • Windows 11 x64, local administrator account (SID RID 1001, i.e. not the built-in RID-500 Administrator, and UAC is simply turned off)
    • Failure: codex (interactive TUI) exits with the exact error from this report
    Error: start the Windows daemon from a non-elevated terminal; shared clients must not inherit administrator privileges
    To work without the background server, rerun the same command with --no-daemon (including resume or fork and its arguments).
    

    Why no non-elevated terminal exists here

    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
      EnableLUA                  = 0
      ConsentPromptBehaviorAdmin = 0
      PromptOnSecureDesktop      = 0
    

    With EnableLUA = 0 no filtered token is ever created, so there is nothing to de-elevate to. Verified from a shell started normally from Explorer:

    > whoami /groups
    Mandatory Label\High Mandatory Level            S-1-16-12288
    BUILTIN\Administrators                           Mandatory group, Enabled by default, Enabled group
    

    Administrators appears as an enabled group rather than deny only, i.e. the token really is elevated. The process chain confirms it is not a one-off elevated window:

    <shell>                          High integrity
      <- <desktop app started from Explorer>   High integrity
        <- explorer.exe                        High integrity
    

    So "Run as administrator" vs. normal launch is not a distinction that exists on this machine — everything is already elevated, which is why the check in ensure_not_elevated() (TokenIsElevated != 0, from #42405) fails for every terminal.

    What still works / what is blocked

    • codex --no-daemon works, and codex works with [features] daemon_auto_start = false (same workaround as reported above).
    • codex exec does not hit this error — it got as far as creating a session normally. Only the interactive path is blocked.
    • codex app-server daemon version reports failed to connect to <CODEX_HOME>\app-server-control\app-server-control.sock, i.e. no daemon is running.

    Suggestion

    The elevation guard itself looks correct — non-elevated clients must not inherit administrator privileges through a shared daemon. The problem is that a failed daemon start aborts the CLI, while #42405 already added a fallback to the embedded server when an implicitly discovered daemon cannot connect. Extending that fallback to "daemon start refused because the launcher is elevated" would keep codex usable here without weakening the privilege separation.

    At minimum, the guidance should not recommend a workaround that is impossible on a UAC-disabled machine: --no-daemon is fine, "start the daemon from a non-elevated terminal" is not.

  11. Matheus-Morais commented on Sep 26, 2026

    @Matheus-Morais

    Adding another Windows 11 reproduction of the 0.157.0 daemon regression.

    Environment

    • Codex CLI: codex-cli 0.157.0
    • OS: Windows 11 Enterprise, build 26200
    • Shell: PowerShell
    • Install: npm global package (%APPDATA%\npm\node_modules\@openai\codex)

    Behavior

    Starting Codex normally requires the workaround:

    codex --no-daemon

    The daemon package is present under %USERPROFILE%\.codex\packages\app-server-daemon, but no daemon socket is available. Running:

    codex app-server daemon version

    returns:

    Error: failed to connect to C:\Users\<USER>\.codex\app-server-control\app-server-control.sock
    Caused by:
        Uma operação de soquete encontrou uma rede inoperante. (os error 10050)
    

    The active Codex process confirms that the working session is launched with --no-daemon.

    Expected behavior

    codex should start successfully with the managed daemon, or automatically fall back to the embedded/foreground app-server when the daemon cannot start or its control socket is unavailable.

    Workaround

    codex --no-daemon
  12. Abdullahjm commented on Sep 26, 2026

    @Abdullahjm

    I'm getting this issue now.

  13. TomsTech commented on Sep 26, 2026

    @TomsTech

    This is an active incident. +1

  14. 39 remaining items

  15. Kpax7 commented on Sep 30, 2026

    @Kpax7

    Before deciding, we’d appreciate feedback:

    1. Are you intentionally running Codex as administrator, or does your environment make that unavoidable?
    2. Would automatic --no-daemon behavior meet your needs?

    I have always used my windows with UAC disabled and my environment is always elevated. So there is no choice for me here. I think "no daemon" mode must be default and if anyone needs a creepy-always-running-daemon forced in their throat can enable it via options or flags, something like:
    codex --enable-shared-daemon

  16. count23all commented on Oct 1, 2026

    @count23all

    Just got it now, Windows 11 on the newesst version v0.159.3. --no-daemon worked, nothing else did.

  17. fmiandres commented on Oct 1, 2026

    @fmiandres
    1. Are you intentionally running Codex as administrator, or does your environment make that unavoidable?
    2. Would automatic --no-daemon behavior meet your needs?

    The installation “Access is denied” error needs separate investigation; this proposed policy would not resolve those.

    For all of these issues, codex --no-daemon should provide a temporary workaround as we investigate these issues.

    1. No, by far not. I did try to start it as admin and it appropiately refused to run.
    2. No. That would remove a big chunk of functionality right there.

    One policy we’re considering:

    • Normal terminal: use the shared background server.
    • Administrator terminal: automatically behave like --no-daemon, preserving administrator permissions and showing a brief notice or warning.

    That would be a great compromise, no need for admin daemon imo.

  18. MusicManiac commented on Oct 1, 2026

    @MusicManiac

    I'm sorry but defaulting to --no-daemon is not a solution. How exactly are we supposed to switch between agents if session does not connect to shared background server? If had some work on one agent and now I can't access it to continue work related to that agent. Unless I am missing something?

    Issue still persists on Codex CLI 0.159.3 on Windows, rolling back to 0.156.1 does not restore daemon into working state.

    160.0 as well...

    PS C:\...> codex --version
    codex-cli 0.160.0
    PS C:\...> codex                       
    Error: failed to open daemon process: 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).
    
  19. MusicManiac commented on Oct 1, 2026

    @MusicManiac

    Update: just ask codex to investigate the issue and its own logs lmao

    Root cause confirmed: a stale Codex daemon PID was reused by Windows Defender.

    Do not terminate PID 8188—it is Windows Defender.

    Close Codex/VS Code sessions, then preserve and replace only the stale daemon state:

    Rename-Item -LiteralPath "C:\Users\xxx\.codex\app-server-control" -NewName "app-server-control.stale-20261001"
    Rename-Item -LiteralPath "C:\Users\xxx\.codex\app-server-daemon" -NewName "app-server-daemon.stale-20261001"
    
    codex app-server daemon start
    codex app-server daemon version
    

    This does not touch authentication, configuration, conversations, or databases. The renamed directories remain recoverable.

    daemon back up and working for me on 0.160.0

  20. PPRRLLRR commented on Oct 1, 2026

    @PPRRLLRR

    Additional reproduction on Windows 11 x64 with Codex CLI 0.159.3 installed via npm.

    This appears to be the same daemon regression, specifically the Access is denied (os error 5) installation path.

    Environment

    • Windows 11 x64
    • PowerShell
    • npm global install
    • Affected version: codex-cli 0.159.3
    • Known working rollback: codex-cli 0.154.0

    Reproduction

    codex

    The TUI opens briefly, then exits after a few seconds.

    Running:

    codex --no-alt-screen

    exposes:

    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).
    

    codex --no-daemon works normally, including model/auth/network usage.

    Direct daemon start reproduces the failure:

    codex app-server daemon start

    Output:

    Installing daemon from CLI version 0.159.3 into C:\Users\<USER>\.codex\packages/app-server-daemon...
    Error: Access is denied. (os error 5)
    

    Diagnostics performed

    • codex app-server itself starts and waits normally.
    • codex doctor reported auth/network/state DBs healthy and no fatal failure.
    • The app-server daemon package directory ACL grants the user FullControl; no explicit Deny ACE was present.
    • The install lock file was not held; exclusive open succeeded.
    • Creating and renaming directories under .codex\packages\app-server-daemon\releases succeeded.
    • Creating/removing a junction under .codex\packages succeeded.
    • No Defender event corresponding to the failure was observed in the test window.
    • Each failed install left a new .staging.* directory under:
      C:\Users\<USER>\.codex\packages\app-server-daemon\releases
    • In the latest failed staging directory, root package layout and codex-package.json matched the npm source package.
    • The staging bin directory contained only codex.exe; the npm source bin contains both:
      • codex.exe
      • codex-code-mode-host.exe
    • Manually copying codex-code-mode-host.exe into the failed staging directory succeeds, and SHA-256 hashes then match the npm source binaries exactly.
    • Running the staged codex.exe app-server daemon start still reproduces Access is denied (os error 5), so the missing host binary is likely a symptom of where installation aborts rather than sufficient proof of the exact failing operation.

    Workaround / rollback

    npm install -g @openai/codex@0.154.0
    codex --version
    # codex-cli 0.154.0
    codex

    After rollback to 0.154.0, normal codex startup works again without --no-daemon.

    This suggests the daemon package installation/update path in newer Windows CLI versions is failing before the staging release is finalized. It would be very useful if the daemon installer logged the exact filesystem/process operation that returns Win32 error 5.

  21. refunringle commented on Oct 6, 2026

    @refunringle

    If you need features from the latest version, you can bypass the problematic daemon:

    Use 'codex --no-daemon'

    Or

    Use '0.156.1' Version

  22. pascal-maker commented on Oct 7, 2026

    @pascal-maker

    problem still not fixed? lol!

  23. refunringle commented on Oct 7, 2026

    @refunringle

    Still issue :

    Environment

    • Codex Windows package: 26.903.8094.0 (x64)
    • Codex Npm Package Version @0.160.1
    • Codex CLI on PATH: 0.160.1
    • Additional running Codex runtime: 0.153.4
    • Windows: Windows 10 Pro, version 22H2
    • Windows OS build: 19045.6456
    • Architecture: x64
    • Shell: Windows PowerShell 5.1.19041.6456
    • Execution environment: Native Windows / PowerShell
    • Sandbox: workspace-write; restricted network access

    Hardware

    • Computer: Dell OptiPlex 7060
    • CPU: Intel Core i5-8600 @ 3.10 GHz
  24. q1575825411 commented on Oct 8, 2026

    @q1575825411

    Additional reproduction: Codex CLI 0.161.0 on Windows

    I can reproduce the Windows daemon startup failure after upgrading Codex CLI from 0.155.1 to 0.161.0.

    Environment

    • OS: Windows x64
    • Shell: PowerShell
    • Installation: npm global (npm install -g @openai/codex)
    • Last known working version: 0.155.1
    • Failing version: 0.161.0

    Steps to reproduce

    1. Install Codex CLI 0.161.0.
    2. Run codex --version.
    3. Run codex.
    4. Observe the following error:
    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).
    

    Observed results

    • 0.161.0: Normal startup fails.
    • 0.161.0 with --no-daemon: Works.
    • Downgrading to 0.155.1: Normal startup works again.
    • The existing config.toml was retained.

    Expected behavior

    Codex should start normally without requiring --no-daemon.

    Additional context

    The npm installation logs confirm that 0.155.1 was installed on September 21, 2026, and 0.161.0 was installed on October 8, 2026.

    This appears to be a regression involving the Windows background daemon. The exact failing Windows operation has not yet been identified.

  25. shellscape commented on Oct 8, 2026

    @shellscape

    For what it's worth this is also an issue on Mac OS 26.4.1

  26. orazdow commented on Oct 8, 2026

    @orazdow

    Why is there a daemon added to startup at all? UNFUCK YOURSELVES.

  27. axeksy commented on Oct 12, 2026

    @axeksy

    Additional reproduction on Codex CLI 0.162.1: shared background functionality is still unavailable for a Windows user who is not a member of Administrators, when UAC is disabled.

    Environment

    • Windows x64, OS version 10.0.26300.0
    • Windows Terminal 1.24.12741.0, PowerShell
    • Codex CLI 0.162.1 (npm package)
    • Standard domain user; Administrator role membership check returns False
    • System UAC configuration: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA = 0

    Reproduction

    1. On a Windows system with UAC disabled, sign in with a standard user account that is not a member of Administrators.
    2. Open Windows Terminal normally, without selecting "Run as administrator".
    3. Run codex.
    4. Codex displays:
    Running as administrator: shared background server disabled. To enable it, restart Codex in a terminal without administrator permissions.
    

    Verified diagnostics

    Outside the Codex command sandbox, the current account's role membership was checked with:

    $identity = [Security.Principal.WindowsIdentity]::GetCurrent()
    $principal = New-Object Security.Principal.WindowsPrincipal($identity)
    $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
    # False

    Native process-token queries (OpenProcessToken / GetTokenInformation) returned the following for both WindowsTerminal.exe and codex.exe:

    TokenElevation: True
    TokenElevationType: 1 (TokenElevationTypeDefault)
    

    whoami /groups also showed High Mandatory Level, without Administrators membership. The npm PowerShell launcher simply invokes Node/Codex and contains no explicit elevation request.

    These are observed values. The exact reason for the discrepancy and Codex's detection implementation have not been confirmed; a UAC-disabled token edge case is suspected.

    Workaround and impact

    The user confirmed that codex --no-daemon works. However, this does not restore shared background functionality, which the user needs for some workflows.

    Expected behavior

    Please investigate whether the shared daemon privilege check incorrectly equates the elevation flag with actual administrator privileges when UAC is disabled. If this token state must be rejected for security reasons, please provide an accurate diagnostic and a supported recovery path for standard users who cannot change system UAC policy.

    Related: #49176 (closed as duplicate); this report provides token diagnostics for the standard-user/UAC-disabled case on 0.162.1. Usernames, domain names, and organization details have been omitted.

  28. Chalermdej-l commented on Oct 24, 2026

    @Chalermdej-l

    Hi

    I asked Codex about the issue, and here is what I did to fix this: I no longer see the daemon pop up. Just want to share in case this helps other people.

    I am on window 11, So it seems my app server version and the CLI are mismatched

    • CLI: 0.164.0
    • Running daemon: 0.157.1

    And i ran the below command
    codex.cmd app-server daemon update
    codex.cmd app-server daemon restart
    codex.cmd app-server daemon version

    To update it if a the version already exist in the machine run instead
    codex.cmd app-server daemon update --from-cli --yes

    And this seem to no longer cause the pop up terminal in my case.

  29. L1miter commented on Nov 10, 2026

    @L1miter

    Hi,
    I've had this issue a few times now, and aside from reinstalling Codex, deleting daemon.pid, daemon.pid.lock, and daemon.lock in .codex\app-server-daemon also fixed it for me. Just sharing in case it helps anyone else.

    codex-cli 0.167.0
    daemon version: 0.167.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIapp-serverbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions