Windows Codex runner injects duplicate PATH/Path env vars, breaking pnpm exec local bin resolution

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

What version of the Codex App are you using (From “About Codex” dialog)?

26.422.30944

What subscription do you have?

Plus

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

On Windows, Codex desktop runner starts tool execution with duplicate PATH environment variables: both PATH and Path.

Inside Codex runner:

node -e "console.log(Object.keys(process.env).filter(k => k.toLowerCase() === 'path'))"

Output:

[ 'PATH', 'Path' ]

This breaks pnpm exec local binary resolution. Project-local binaries in node_modules/.bin are not found.

Example:

pnpm exec tsc --version

Output inside Codex runner:

'tsc' is not recognized as an internal or external command,
operable program or batch file.

The same happens with other local binaries:

pnpm exec vite --version

Output:

'vite' is not recognized as an internal or external command,
operable program or batch file.

Environment:

  • OS: Windows
  • App: Codex desktop
  • Codex runner shell: C:\Program Files\WindowsApps\Microsoft.PowerShell_7.6.1.0_x64__8wekyb3d8bbwe\pwsh.exe
  • PowerShell in Codex runner: 7.6.1
  • pnpm: 10.18.3
  • Node: 22.12.0

What steps can reproduce the bug?

  1. Open Codex desktop on Windows.
  2. Open a project that has local binaries installed under node_modules/.bin, for example a frontend project with typescript and vite.
  3. Run this inside Codex tool execution:
node -e "console.log(Object.keys(process.env).filter(k => k.toLowerCase() === 'path'))"
  1. Observe that Codex runner prints:
[ 'PATH', 'Path' ]
  1. Run:
pnpm exec tsc --version
  1. Observe that it fails:
'tsc' is not recognized as an internal or external command,
operable program or batch file.

For comparison, in a normal Windows PowerShell terminal on the same machine:

node -e "console.log(Object.keys(process.env).filter(k => k.toLowerCase() === 'path'))"

prints:

[ 'Path' ]

and:

pnpm exec tsc --version

prints:

Version 5.9.3

The registry environment variables were checked and normalized. Full registry listing shows only Path under both:

HKCU\Environment
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

A workaround using ProcessStartInfo with a manually cleaned environment also confirms the issue is caused by duplicate PATH/Path in the Codex runner process environment.

What is the expected behavior?

Codex runner on Windows should start tool execution with a normalized process environment containing only one PATH key, preferably Path.

Expected inside Codex runner:

node -e "console.log(Object.keys(process.env).filter(k => k.toLowerCase() === 'path'))"
[ 'Path' ]

Then pnpm exec should correctly inject node_modules/.bin and resolve project-local binaries.

Expected:

pnpm exec tsc --version
Version 5.9.3

Additional information

_No response_

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 4 months ago

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

  • #19546
  • #19171

Powered by Codex Action

FylmTM · 4 months ago

Same issue here. Can't start dev server with npm due to both PATH and Path injected.

VincentC4S · 3 months ago

I’m seeing what appears to be the same root cause, but with a different downstream failure: Roslyn/MSBuild shared compilation breaks in the Codex-managed shell on Windows.

What I observed:

  • Plain PowerShell and Windows Terminal show only one path variable entry.
  • Inside the Codex-managed shell, the raw native environment block contains both:
  • PATH=...
  • Path=...
  • This is not visible through normal PowerShell Env: inspection, but it is visible when reading the raw environment block directly.

Impact in my case:

  • Normal MSBuild rebuild with shared compilation enabled fails with:

Microsoft.CSharp.Core.targets(89,5): error MSB3883: Unexpected exception:
error : Item has already been added. Key in dictionary: 'Path' Key being added: 'PATH'

Repro:

  1. Run inside Codex on Windows:

msbuild "project.csproj" /t:Rebuild /p:Configuration=Debug /v:minimal

  1. Observe failure with the duplicate Path/PATH error.

Workarounds that succeed:

  • Disable shared compilation:

msbuild "project.csproj" /t:Rebuild /p:Configuration=Debug /p:UseSharedCompilation=false /v:minimal

  • Launch MSBuild from a sanitized ProcessStartInfo environment containing only a single PATH entry.

This looks like the same Codex Windows runner environment duplication bug described here, but affecting Roslyn/MSBuild instead of pnpm exec.