PowerShell profile with oh-my-posh fails inside Codex
What version of Codex CLI is running?
codex-cli 0.121.0 & codex App
What subscription do you have?
Plus
Which model were you using?
gpt-5.4
What platform is your computer?
Microsoft Windows NT 10.0.26200.0 x64
What terminal emulator and version are you using (if applicable)?
Windows Terminal Powershell 7.6.0
What issue are you seeing?
When Codex runs PowerShell commands on Windows, it appears to load my PowerShell profile. My PowerShell profile
contains the following oh-my-posh initialization command:
``powershell``
oh-my-posh init pwsh --config 'catppuccin_mocha' | Invoke-Expression
I have oh-my-posh installed locally. When I open PowerShell myself and run:
````
notepad $PROFILE
the profile file contains:
````
oh-my-posh init pwsh --config 'catppuccin_mocha' | Invoke-Expression
This works correctly in my normal local PowerShell session. I can use PowerShell normally, and oh-my-posh loads
without errors.
However, when Codex runs simple PowerShell commands, Codex prints an error from the PowerShell profile:
```
ResourceUnavailable: C:\Users\Angai\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:1
Line |
1 | oh-my-posh init pwsh --config 'catppuccin_mocha' | Invoke-Expression
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Program 'oh-my-posh.exe' failed to run: An error occurred trying to start process
| 'C:\Users\Angai\AppData\Local\Microsoft\WindowsApps\oh-my-posh.exe' with working directory
| 'C:\code\personal\sky-take-out'. The system cannot access the file.
```
The actual command that I ask Codex to run still succeeds. For example:
npm -v
prints:
11.12.1
but the PowerShell profile error is also printed in the command output.
This also happens with other simple commands such as:
java -version
mvn -v
The important point is that this error only happens inside Codex. When I run the same commands directly in my own
local PowerShell, there is no error.
So this seems related to the Codex Windows sandbox or the way Codex launches PowerShell processes, rather than a
missing or broken local oh-my-posh installation.
Environment details:
OS: Windows 11
Shell: PowerShell
Workspace: C:\code\personal\sky-take-out
PowerShell profile: C:\Users\Angai\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Profile content:
oh-my-posh init pwsh --config 'catppuccin_mocha' | Invoke-Expression
oh-my-posh path shown in Codex error:
C:\Users\Angai\AppData\Local\Microsoft\WindowsApps\oh-my-posh.exe
<img width="1468" height="850" alt="Image" src="https://github.com/user-attachments/assets/55d6128b-47b5-4702-8443-39d8ec3e59ac" />
<img width="1468" height="850" alt="Image" src="https://github.com/user-attachments/assets/945c423d-4538-4f87-9546-f8d913000a79" />
What steps can reproduce the bug?
- Use Codex on Windows with PowerShell as the shell.
- Install oh-my-posh locally.
- Open a normal local PowerShell session and run:
notepad $PROFILE
- Add or confirm that the profile contains this line:
oh-my-posh init pwsh --config 'catppuccin_mocha' | Invoke-Expression
- Confirm that this profile works correctly in a normal local PowerShell session.
- In Codex, ask it to run a simple PowerShell command, for example:
npm -v
or:
java -version
or:
mvn -v
- Observe the command output.
Actual result inside Codex:
The requested command succeeds, but Codex also prints a PowerShell profile error similar to:
Program 'oh-my-posh.exe' failed to run:
'C:\Users\Angai\AppData\Local\Microsoft\WindowsApps\oh-my-posh.exe'
The system cannot access the file.
Comparison outside Codex:
If I open PowerShell directly on the same machine and run the same commands, there is no error. The profile loads
successfully and oh-my-posh works as expected.
What is the expected behavior?
_No response_
Additional information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗