codex - 💡(How to fix) Fix Windows Codex runner injects duplicate PATH/Path env vars, breaking pnpm exec local bin resolution [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#19549Fetched 2026-04-26 05:15:19
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Root Cause

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.

Fix Action

Fix / Workaround

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.

Code Example

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

---

[ 'PATH', 'Path' ]

---

pnpm exec tsc --version

---

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

---

pnpm exec vite --version

---

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

---

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

---

[ 'PATH', 'Path' ]

---

pnpm exec tsc --version

---

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

---

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

---

[ 'Path' ]

---

pnpm exec tsc --version

---

Version 5.9.3

---

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

---

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

---

[ 'Path' ]

---

pnpm exec tsc --version

---

Version 5.9.3
RAW_BUFFERClick to expand / collapse

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

extent analysis

TL;DR

The issue can be fixed by normalizing the process environment in the Codex runner to contain only one PATH key, preferably Path.

Guidance

  • The duplicate PATH and Path environment variables in the Codex runner process environment are causing the issue, which can be verified by running node -e "console.log(Object.keys(process.env).filter(k => k.toLowerCase() === 'path'))" inside the Codex runner.
  • To mitigate this, the environment variables can be manually cleaned using ProcessStartInfo before starting the tool execution.
  • The pnpm exec command relies on the correct resolution of project-local binaries in node_modules/.bin, which is broken due to the duplicate PATH variables.
  • Normalizing the environment variables to contain only one Path key should resolve the issue and allow pnpm exec to correctly inject node_modules/.bin and resolve project-local binaries.

Example

No code snippet is provided as the issue is related to environment variable normalization, which is not directly related to code.

Notes

The issue is specific to the Codex desktop runner on Windows and is caused by the duplicate PATH and Path environment variables. The workaround using ProcessStartInfo with a manually cleaned environment confirms the issue.

Recommendation

Apply a workaround to normalize the environment variables in the Codex runner process environment to contain only one Path key, as this is the most direct way to resolve the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING