EBADF: bad file descriptor - Windows 11 #3563
Copy link
Copy link
Closed
Labels
Description
Description
Installed opencode via npm, bun and chocolatey - download of precompiled executable - all have the same behaviour on Windows 11 opencode
ERROR 2025-10-30T00:15:05 +213ms service=default name=Error message=EBADF: bad file descriptor, read stack=Error: EBADF: bad file descriptor, read
at readFileSync (unknown)
at _readLocaleFile (../../node_modules/.bun/y18n@5.0.8/node_modules/y18n/build/lib/index.js:135:51)
at __ (../../node_modules/.bun/y18n@5.0.8/node_modules/y18n/build/lib/index.js:24:18)
at positional (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:802:81)
at builder (src/cli/cmd/tui.ts:23:47)
at applyBuilderUpdateUsageAndParse (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/command.js:174:35)
at runCommand (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/command.js:164:36)
at [runYargsParserAndExecuteCommands] (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:1415:93)
at parse (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:704:29)
at src/index.ts:89:11
at asyncModuleEvaluation (native:2)
at processTicksAndRejections (native:7:39) fatal
Error: Unexpected error, check log file at for more details
EBADF: bad file descriptor, read
syscall: "read",
errno: -9,
code: "EBADF"
at readFileSync (unknown:1:1)
at _readLocaleFile (../../node_modules/.bun/y18n@5.0.8/node_modules/y18n/build/lib/index.js:135:51)
at __ (../../node_modules/.bun/y18n@5.0.8/node_modules/y18n/build/lib/index.js:24:18)
at positional (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:802:81)
at builder (src/cli/cmd/tui.ts:23:47)
at applyBuilderUpdateUsageAndParse (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/command.js:174:35)
at runCommand (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/command.js:164:36)
at [runYargsParserAndExecuteCommands] (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:1415:93)
at parse (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:704:29)OpenCode version
15.29
Steps to reproduce
install opencode on windows 11 from this year
try and run it
Screenshot and/or share link
No response
Operating System
Windows 11
Terminal
Windows Terminal, Git Bash - same behaviour
Reactions are currently unavailable
Activity
rekram1-node commentedon Oct 30, 2025
I will look into this our windows support sucks, needs to be way better, my apologies
RichardScottOZ commentedon Nov 1, 2025
@rekram1-node - if you want anything tested, let me know. I did try several recent versions too to check - same behaviour. Tried a lot of things - symlinks, aliases of git bash shells, paths, env var or whatever, no luck - so probably needs solving at a lower level in whatever that interplay of local, assuming shells and bun even if you don't have it from someone that understands that part well.
rekram1-node commentedon Nov 1, 2025
sounds good, I did just setup a windows 11 vm so I will start testing in it more
aaron-cardenas commentedon Dec 9, 2025
same for me on win 10:
c:\wamp\www\Comunal>scoop install extras/opencode
Installing 'opencode' (1.0.134) [64bit] from 'extras' bucket
Loading opencode-windows-x64.zip from cache
Checking hash of opencode-windows-x64.zip ... ok.
Extracting opencode-windows-x64.zip ... done.
Linking ~\scoop\apps\opencode\current => ~\scoop\apps\opencode\1.0.134
Creating shim for 'opencode'.
Creating shortcut for OpenCode (opencode.exe)
'opencode' (1.0.134) was installed successfully!
c:\wamp\www\Comunal>opencode
ERROR 2025-12-09T00:50:18 +388ms service=default name=Error message=EBADF: bad file descriptor, read stack=Error: EBADF: bad file descriptor, read
at readFileSync (unknown)
at _readLocaleFile (../../node_modules/.bun/y18n@5.0.8/node_modules/y18n/build/lib/index.js:135:51)
at __ (../../node_modules/.bun/y18n@5.0.8/node_modules/y18n/build/lib/index.js:24:18)
at positional (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:802:81)
at builder (src/cli/cmd/tui/thread.ts:19:8)
at applyBuilderUpdateUsageAndParse (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/command.js:174:35)
at runCommand (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/command.js:164:36)
at [runYargsParserAndExecuteCommands] (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:1415:93)
at parse (../../node_modules/.bun/yargs@18.0.0/node_modules/yargs/build/lib/yargs-factory.js:704:29)
at src/index.ts:111:13
at asyncModuleEvaluation (native:2)
at processTicksAndRejections (native:7:39) fatal
Error: Unexpected error, check log file at for more details
EBADF: bad file descriptor, read
syscall: "read",
errno: -9,
code: "EBADF"
c:\wamp\www\Comunal>scoop uninstall extras/opencode
Uninstalling 'opencode' (1.0.134).
Removing shim 'opencode.shim'.
Removing shim 'opencode.exe'.
Removing shortcut ~\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Scoop Apps\OpenCode.lnk
Unlinking ~\scoop\apps\opencode\current
'opencode' was uninstalled.
rekram1-node commentedon Dec 9, 2025
Does that happen w/ all install methods for you?
aaron-cardenas commentedon Dec 9, 2025
I tried the installation with npm, Scup and again with Chocolatey, got the same error.
AlexanderVoid45 commentedon Jan 18, 2026
same for me at 1 of my pc`s of 2(where ive tried opencode). have same setup, same antimalvare.
AlexanderVoid45 commentedon Jan 22, 2026
Found the fix
The issue is in
y18nlibrary - it tries toreadFileSynclocale files, which fails withEBADF/EUNKNOWNin Bun compiled binaries on Windows.Solution
Add patch file
patches/y18n@5.0.8.patch:And add to
package.json:Tested on Windows 11 (22000.2538) - both CLI and desktop work after this fix.
github-actions commentedon Mar 26, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
RichardScottOZ commentedon Mar 26, 2026
Is this going to be built in?