os error 2 after Windows Update

Resolved 💬 8 comments Opened Jan 14, 2026 by carldebilly Closed Jan 30, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.81.0

What subscription do you have?

ChatGPT PLUS

Which model were you using?

gpt-5.2-codex

What platform is your computer?

Windows 11 PRO 64 bits

What issue are you seeing?

After the reboot to apply Windows Security Update KB5074109, Codex is unable to start, producing this error message:

PS C:\Users\Me> codex
Error: The system cannot find the file specified. (os error 2)

I checked the following:

  • Nothing blocked on Windows Defender
  • I reinstalled MSVC librairies (repair)
  • I tried other versions of Codex - 0.78.0, 0.79.0, 0.80.0 -- those who were working until this morning
  • I rebooted plenty of times
  • I reinstalled npm to latest version (in case)
  • I confirm the C:\Users\Me\AppData\Roaming\npm\node_modules\@openai\codex\vendor\x86_64-pc-windows-msvc\codex\codex.exe exists and a direct execution produces the same result (os error 2)

What steps can reproduce the bug?

I don't know what to check

What is the expected behavior?

_No response_

Additional information

Windows Security Update: KB5074109 (26200.7623)
.NET 9.0.12 / 8.0.23 updates installed same day

View original on GitHub ↗

8 Comments

etraut-openai contributor · 6 months ago

Sounds like a path configuration issue on your system. You might want to ask ChatGPT to suggest potential fixes.

carldebilly · 6 months ago
Sounds like a path configuration issue on your system. You might want to ask ChatGPT to suggest potential fixes.

Windows-only failure after Windows Update (codex.exe)

After a Windows Update, codex fails to start on one machine, while the same Codex version works on other Windows machines.

Node does start correctly and executes codex.js.
The failure occurs when codex.js spawns the native binary codex.exe.

The user-visible error is always:

Error: The system cannot find the file specified. (os error 2)

However, codex.exe does exist and is launched.

---

Key observations (Process Monitor)

Using Sysinternals Process Monitor, filtering on codex.exe:

  • codex.exe attempts to load app-local DLLs from:

``
vendor\x86_64-pc-windows-msvc\
`
(e.g.
codexVCRUNTIME140.dll, codexbcrypt.dll, codexuserenv.dll`)

  • These DLLs are not present → NAME NOT FOUND
  • Windows then correctly falls back to:

``
C:\Windows\System32\vcruntime140.dll
C:\Windows\System32\bcrypt.dll
C:\Windows\System32\userenv.dll
C:\Windows\System32\cryptbase.dll
C:\Windows\System32\sspicli.dll
``

This exact fallback behavior also occurs on machines where Codex works.

---

Where it fails

On the broken machine (post Windows Update):

  • Same DLL lookup and fallback sequence
  • System DLLs are found
  • Process exits immediately during loader initialization
  • No missing DLL, no access denied, no Defender event
  • Node only reports a generic os error 2

This strongly suggests a Windows runtime / loader / VC++ runtime issue, not a missing file.

---

Conclusion

  • Not a Node or npm issue
  • Not a PATH issue
  • Not a missing file in vendor
  • Failure happens inside codex.exe during native initialization on Windows
  • Likely triggered by a Windows Update affecting the runtime environment

Better diagnostics around native process startup on Windows would help, as the current error message is misleading.

etraut-openai contributor · 6 months ago

We haven't heard reports of this from other Windows users, so I don't think this is a general issue with Codex. It's likely something that's specific to your system or configuration. I don't think there's much more we can do to help diagnose this.

One additional thought... perhaps the Visual Studio dependencies is corrupt on your system. Follow these instructions to reinstall.

emmanQabe · 6 months ago

i have the same issue

carldebilly · 5 months ago

I FOUND THE FIX TO THE PROBLEM!!!!

Issue Resolution Report: Codex Launch Failure

Problem Identified

  • The codex command was failing with error: "Error finding codex home: The system cannot find the file specified. (os error 2)"
  • Root cause: The CODEX_HOME environment variable was set to D:\src\Uno\.codex, which did not exist

Changes Made

  • Removed the CODEX_HOME environment variable at the User level using PowerShell
  • Cleared the variable from the current session

Resolution

  • Codex now runs successfully (version 0.91.0 confirmed)
  • The application uses its default installation path instead of the missing directory
carldebilly · 5 months ago

@etraut-openai
@emmanQabe

etraut-openai contributor · 5 months ago

@carldebilly, nice find! We should be able to detect that and provide a better error message. Reopening the issue.

etraut-openai contributor · 5 months ago

The next version of the Codex CLI will have a better error message for this case.