Misleading Browser policy error when configured Codex CLI path does not exist

Open 💬 5 comments Opened Jun 16, 2026 by goodneamtakenbydogs
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Summary

On Windows Codex Desktop, Browser Use can report a misleading enterprise policy error when the underlying failure is that the configured Codex CLI path points to a stale or missing codex.exe.

The user-facing error I saw was:

Browser Use cannot access http://127.0.0.1:<port> because enterprise network policy blocks it.

However, probing the Browser policy/config path showed the lower-level failure was:

failed to start codex app-server: The system cannot find the path specified. (os error 3)

In this repro, the missing path came from stale Codex CLI path configuration after an update.

Environment

  • OS: Windows
  • Codex Desktop/native host versions observed: 26.602.71036 / 26.609.x
  • Codex CLI after repair: 0.140.0-alpha.2
  • Codex home in this environment: D:\.codex

Note: this is a custom Codex home. Other users may see this under %USERPROFILE%\.codex or another CODEX_HOME.

Stale paths found

The stale codex.exe path appeared in both places:

<CODEX_HOME>\config.toml
<CODEX_HOME>\chrome-native-hosts-v2.json

Example stale path:

C:\Users\<USER>\AppData\Local\OpenAI\Codex\bin\fb2111b91430cb17\codex.exe

That hash directory no longer existed.

After updating both config locations to the existing codex.exe path, restarting Codex Desktop made the Browser policy/config path work again.

Failure chain

configured Codex CLI path points to a missing codex.exe
  -> Codex app-server startup fails with os error 3
  -> Browser policy/config read fails
  -> Browser client fails closed
  -> user sees enterprise network policy blocks it

The final message sends the user toward enterprise policy, localhost permissions, browser plugin injection, or network security. In this case, the actual fix was to correct stale local codex.exe paths.

Expected behavior

When the configured Codex CLI path does not exist, the error should say so directly, for example:

Failed to start Codex app-server because the configured Codex CLI path does not exist:
C:\Users\<USER>\AppData\Local\OpenAI\Codex\bin\fb2111b91430cb17\codex.exe

Please restart/reinstall Codex or update CODEX_CLI_PATH / paths.codexCliPath so the path points to an existing codex.exe.

The Browser policy layer should distinguish at least:

  1. actual enterprise policy denial
  2. config/policy service unavailable
  3. configured Codex CLI path missing
  4. app-server startup failure
  5. permission/authentication failure

Only the first case should be surfaced as enterprise network policy blocks it.

Suggested minimal fix

Before starting Codex app-server from a configured CLI path, check whether the configured codex.exe path exists.

If not, return a specific error such as:

CodexCliPathNotFound

The error should include:

  • the configured path
  • which config source provided it, e.g. config.toml or chrome-native-hosts-v2.json
  • a recovery hint, such as restarting/reinstalling Codex or regenerating the native host config

Related issues

This seems related to the existing Windows stale path / app-server issues, but the focus here is the misleading Browser policy error mapping:

  • #26011: stale config.toml paths after auto-update
  • #20206: Browser Use fails with failed to start codex app-server (os error 3)
  • #26792: broader MS Store update stale config/plugin cascade

Those issues explain nearby root causes. This issue is specifically about surfacing the missing configured CLI path instead of reporting an enterprise policy denial.

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 2 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #27160

Powered by Codex Action

Kbediako contributor · 2 months ago

I hit the same failure mode on Windows Codex Desktop.

Environment:

  • Codex app/browser bundle: 26.623.42026
  • Codex CLI after repair: 0.142.3
  • Codex home: %USERPROFILE%\.codex

Symptom:
Browser Use failed for every site with:
"Browser Use cannot access https://... because enterprise network policy blocks it."

Findings:

  • configRequirements/read returned requirements: null, so this was not a real managed enterprise policy.
  • DNS and TCP 443 were fine.
  • CODEX_CLI_PATH in both the process/user environment and %USERPROFILE%\.codex\config.toml pointed to a missing path:

...\vendor\x86_64-pc-windows-msvc\codex\codex.exe

  • The actual installed CLI path was:

...\vendor\x86_64-pc-windows-msvc\bin\codex.exe

Fix:

  • Updated %USERPROFILE%\.codex\config.toml [mcp_servers.node_repl.env].CODEX_CLI_PATH
  • Updated the user-level CODEX_CLI_PATH environment variable
  • Fully exited and reopened Codex

Result:
Browser Use recovered. It could navigate to https://asabeko.com/, read the page title/DOM, scroll, and click the menu.

Extra note:
A config-only fix did not survive until the user-level environment variable was also corrected, because Codex appeared to regenerate the stale value on app restart. I hope this helps!

kutayilmaaz · 2 months ago

Adding another confirmation from Windows Codex Desktop 26.623.42026.

In this case the visible error was:

Browser Use cannot access http://localhost:3000 because enterprise network policy blocks it

The actual root cause was a stale Windows User environment variable:

CODEX_CLI_PATH=C:\Users\<user>\AppData\Local\OpenAI\Codex\bin.bak-...\<hash>\codex.exe

That path no longer existed. The current valid path was:

C:\Users\<user>\AppData\Local\OpenAI\Codex\bin\<current-hash>\codex.exe

Important detail: fixing %USERPROFILE%\.codex\config.toml alone was not enough. After restarting Codex, config.toml reverted back to the stale bin.bak-... path because the user-level environment variable was still stale.

Fix applied:

[Environment]::SetEnvironmentVariable(
  "CODEX_CLI_PATH",
  "C:\Users\<user>\AppData\Local\OpenAI\Codex\bin\<current-hash>\codex.exe",
  "User"
)

Then updated config.toml to the same valid path and fully restarted Codex/Chrome.

Result after restart:

  • CODEX_CLI_PATH process env: valid path
  • CODEX_CLI_PATH user env: valid path
  • config.toml: valid path
  • agent.browsers.list() showed both Chrome extension and IAB backends
  • Chrome extension backend connected successfully
  • http://localhost:3000 no longer failed with enterprise policy
  • local page loaded successfully with HTTP 200, title/DOM readable

So the misleading enterprise-policy error can also be caused by a stale user-level CODEX_CLI_PATH that rewrites the config on app startup. It would help if Browser Use/app-server startup reported the effective CODEX_CLI_PATH source, e.g. process env vs user env vs machine env vs config, when the path does not exist.

starriet9 · 1 month ago

Adding a focused diagnostic follow-up for the stale CODEX_CLI_PATH cases described above.

I updated the existing doctor diagnostic branch to also surface the Windows environment-variable layer that can keep reintroducing a stale CLI path:

https://github.com/starriet9/codex/tree/doctor/desktop-runtime-diagnostics

Latest commit:
353bfe26f Diagnose stale CODEX_CLI_PATH env values

The desktop.browser_runtime doctor check now reports:

  • process environment CODEX_CLI_PATH
  • Windows User environment CODEX_CLI_PATH
  • Windows Machine environment CODEX_CLI_PATH

and warns when any of those values:

  • points to a missing codex.exe
  • disagrees with the CODEX_CLI_PATH configured through mcp_servers.node_repl.env

This is meant as a diagnostic only, not the underlying Desktop sync fix. It should make cases like “fixing config.toml does not stick because a stale User environment variable rewrites it on restart” visible in codex doctor.

Local verification on Windows:

cargo fmt --check
git diff --check
cargo test -p codex-cli desktop_runtime

All passed. I am still not opening a PR directly because the contributing guide says external PRs are by invitation only, but the branch is available if this doctor diagnostic would be useful.

zemeng5208 · 16 days ago

I maintain WinBridge Recovery for Windows Codex Desktop local-state recovery: https://github.com/zemeng5208/winbridge-recovery

This failure chain is directly within the diagnostic/recovery scope of the project. WinBridge v3.1.1 resolves the currently installed Store package/runtime and checks stale Codex CLI references across config.toml, Node REPL environment, Native Host/v2 state and related runtime paths before classifying a Browser failure as policy-related.

That distinction matters here because a missing codex.exe can make the Browser policy/config service unavailable and then surface as a misleading enterprise-policy denial. WinBridge validates that the effective configured path actually exists and can repair user-owned stale runtime/config references against the current official installation, with backups and post-repair validation.

The follow-up comments here also show another source that should be checked: a stale Windows User-level CODEX_CLI_PATH can rewrite a repaired config.toml on restart. I am treating environment/config/native-host provenance as part of the same split-brain diagnosis rather than assuming config.toml alone is authoritative.

It does not bypass real enterprise policy. If policy is genuinely enforced, or all local runtime paths are healthy and Browser still fails upstream, the tool should stop at diagnosis rather than override that boundary.