Misleading Browser policy error when configured Codex CLI path does not exist
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:
- actual enterprise policy denial
- config/policy service unavailable
- configured Codex CLI path missing
- app-server startup failure
- 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.tomlorchrome-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.tomlpaths 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.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I hit the same failure mode on Windows Codex Desktop.
Environment:
Symptom:
Browser Use failed for every site with:
"Browser Use cannot access https://... because enterprise network policy blocks it."
Findings:
configRequirements/readreturnedrequirements: null, so this was not a real managed enterprise policy.CODEX_CLI_PATHin both the process/user environment and%USERPROFILE%\.codex\config.tomlpointed to a missing path:...\vendor\x86_64-pc-windows-msvc\codex\codex.exe...\vendor\x86_64-pc-windows-msvc\bin\codex.exeFix:
%USERPROFILE%\.codex\config.toml[mcp_servers.node_repl.env].CODEX_CLI_PATHCODEX_CLI_PATHenvironment variableResult:
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!
Adding another confirmation from Windows Codex Desktop
26.623.42026.In this case the visible error was:
The actual root cause was a stale Windows User environment variable:
That path no longer existed. The current valid path was:
Important detail: fixing
%USERPROFILE%\.codex\config.tomlalone was not enough. After restarting Codex,config.tomlreverted back to the stalebin.bak-...path because the user-level environment variable was still stale.Fix applied:
Then updated
config.tomlto the same valid path and fully restarted Codex/Chrome.Result after restart:
CODEX_CLI_PATHprocess env: valid pathCODEX_CLI_PATHuser env: valid pathconfig.toml: valid pathagent.browsers.list()showed both Chrome extension and IAB backendshttp://localhost:3000no longer failed with enterprise policySo the misleading enterprise-policy error can also be caused by a stale user-level
CODEX_CLI_PATHthat rewrites the config on app startup. It would help if Browser Use/app-server startup reported the effectiveCODEX_CLI_PATHsource, e.g. process env vs user env vs machine env vs config, when the path does not exist.Adding a focused diagnostic follow-up for the stale
CODEX_CLI_PATHcases 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 valuesThe
desktop.browser_runtimedoctor check now reports:CODEX_CLI_PATHCODEX_CLI_PATHCODEX_CLI_PATHand warns when any of those values:
codex.exeCODEX_CLI_PATHconfigured throughmcp_servers.node_repl.envThis is meant as a diagnostic only, not the underlying Desktop sync fix. It should make cases like “fixing
config.tomldoes not stick because a stale User environment variable rewrites it on restart” visible incodex doctor.Local verification on Windows:
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.
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.execan 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_PATHcan rewrite a repairedconfig.tomlon restart. I am treating environment/config/native-host provenance as part of the same split-brain diagnosis rather than assumingconfig.tomlalone 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.