Windows: "Open with VS Code" fails even when VS Code works normally outside Codex
Summary
On Windows, the "Open with VS Code" action in Codex fails even when Visual Studio Code is correctly installed and usable through normal Windows mechanisms.
This does not appear to be a general VS Code installation problem.
Environment
- OS: Windows 11
- Codex Desktop: Microsoft Store package
- Observed in logs as
OpenAI.Codex_26.415.4716.0_x64__2p2nqsd0c76g0 - VS Code:
- Reproduced first with an older custom-path install
- Reproduced again after a clean reinstall to the default path:
C:\Program Files\Microsoft VS Code\Code.exe
Expected behavior
Clicking "Open with VS Code" in Codex should open the current file/folder/workspace in VS Code.
Actual behavior
Codex fails to open VS Code.
Outside Codex, VS Code works normally:
- launching manually from File Explorer works
codeworks from the terminalvscode://works- Windows can recognize VS Code in Default Apps
Key finding
Codex appears to launch Code.exe directly and treats the result as a failure because the process exits with code 1.
Relevant log snippets:
Old install path:
2026-04-20T02:06:20.482Z error [electron-fetch-handler] Failed to open file errorMessage="D:\IDEs\Microsoft VS Code\Code.exe exited with code 1 (D:\Alles\hci\hw3)"
Fresh default install:
2026-04-20T03:47:08.571Z error [electron-fetch-handler] Failed to open file errorMessage="C:\Program Files\Microsoft VS Code\Code.exe exited with code 1 (D:\Alles\hci\hw3)"
Another repro with the fresh install:
2026-04-20T03:47:12.962Z error [electron-fetch-handler] Failed to open file errorMessage="C:\Program Files\Microsoft VS Code\Code.exe exited with code 1 (D:\Alles\hci\hw3)"
Troubleshooting already done
I tested and/or fixed the following:
- reinstalling VS Code
- installing VS Code to the default path
- fixing PATH so
codeworks - fixing file associations / default app registration
- fixing
vscode:// - cleaning old VS Code registry remnants from a previous install
These steps improved Windows-level behavior, but did not fix Codex's "Open with VS Code" action.
Why this looks like a Codex bug
The issue seems specific to Codex's launch strategy on Windows:
- normal Windows / shell / protocol launching works
- Codex's direct
Code.exelaunch fails - the same failure occurred before and after reinstalling VS Code
That suggests Codex may be relying on a Windows launch path that is too brittle.
Possible fix directions
Instead of invoking Code.exe directly, Codex may need to use a more Windows-friendly launch path, for example:
vscode://code/code.cmd- a shell-based open flow rather than treating
Code.exeas a command-style entry point
If helpful, I can provide more environment details or additional log context.
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I checked #18151, and I do not think this is the same issue.
#18151 is about normal file-reference clicks opening the built-in Codex side pane instead of the configured IDE target on macOS, while the context-menu IDE path still works.
My issue is different:
Code.exe exited with code 1So this looks like a Windows VS Code launch/invocation issue, not a side-pane click-routing issue.
In my case, the “Open in VS Code” button in Codex only started working after I disabled “Run this program as an administrator” in the properties of the VS Code executable.
I think Codex should show a visible message when this happens, such as: “VS Code cannot be opened because it is configured to run as administrator.”
Thanks for your solution, though it didn't work on my machine :(