Codex CLI does not execute cmd.exe /c build.bat under WSL

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

What version of Codex is running?

0.42.0

Which model were you using?

gpt-5-codex high

What platform is your computer?

Microsoft Windows NT 10.0.19045.0 x64

What steps can reproduce the bug?

Launch codex cli under wsl in Windows 10, ask Codex to launch this command:
cmd.exe /c build.bat

Codex fails with this error:
Ran cmd.exe /c build.bat
└ <3>WSL (931 - ) ERROR: UtilBindVsockAnyPort:307: socket failed 1

What is the expected behavior?

command is run

What do you see instead?

Ran cmd.exe /c build.bat
└ <3>WSL (931 - ) ERROR: UtilBindVsockAnyPort:307: socket failed 1

Additional information

_No response_

View original on GitHub ↗

8 Comments

morganavr · 9 months ago

I noticed that when Codex CLI adjusted command timeout - command worked successfully. Maybe there is a way to setup command timeouts in config file?

fallonou1999 · 9 months ago

yeah I came across this issue too, and I also found that letting codex adjust bash tool timeout argument solved the problem, kind of weird

ekalchev · 9 months ago

same issue

ekalchev · 9 months ago

I found that wrapping the actual command in double quotes fixes the issue cmd.exe /c "tasklist | findstr build"

jonny64 · 8 months ago

same issue for "git status"
wsl2, codex 0.48

>> Code review started: changes against 'main' <<

• Ran git rev-parse --abbrev-ref 'main@{upstream}'
  └ <3>WSL (281170) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git merge-base HEAD origin/main
  └ <3>WSL (281244) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git merge-base HEAD main
  └ <3>WSL (281309) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git show-ref
  └ <3>WSL (281485) ERROR: UtilBindVsockAnyPort:287: socket failed 1

• Ran git status
  └ <3>WSL (281517) ERROR: UtilBindVsockAnyPort:287: socket failed 1

$ which git
/usr/local/bin/git
$ ls -la /usr/local/bin/git
-rwxr-xr-x 1 root root 133 Aug 21  2023 /usr/local/bin/git
$ /usr/local/bin/git -v
git version 2.50.1.windows.1

seems in my case in my wsl i somehow (mobaxterm terminal) i've got git from windows not local wsl ubuntu git

when i use local ubuntu git it works

$ /usr/bin/git --version
git version 2.34.1
$ codex
› /review current branch against main all commited use /usr/bin/git
• Ran /usr/bin/git rev-parse --abbrev-ref HEAD # now works!
  └ TASK-157
etraut-openai contributor · 8 months ago

We've made a bunch of improvements for WSL in recent versions. I think this issue may no longer be relevant. I'll keep it open until someone is able to confirm.

KiaArmani · 6 months ago

As of v0.80.0 this problem still exists. I tried wrapping the command in double-quotes and without, same result.

miyafujisosoru-dev · 3 months ago

I encountered this problem, but solved changing permission to full access.