You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] HAS_BROKEN_FSTAT_FOR_ZIP_FDS version gate should include Node 24.15+ #7103
PR #7070 fixed the EBADF: bad file descriptor, fstat error for Node 25.7+ by reading CJS source of zip files instead of letting Node fstat the fake fd. However, the version gate only checks for Node >= 25.7:
The same breaking change from nodejs/node#61769 (lib: reduce cycles in esm loader and load it in snapshot, commit ad1078c0) was backported to Node v24.15.0, causing the identical EBADF error on that version.
Confirmed by checking the commits between v24.14.1 and v24.15.0 — PR nodejs/node#61769 is included.
Reproduction
$ node --version
v24.15.0
$ yarn --version
4.14.0
$ yarn install
➤ YN0009: │ unrs-resolver@npm:1.11.1 couldn't be built successfully (exit code 1)
➤ YN0009: │ argon2@npm:0.44.0 couldn't be built successfully (exit code 1)
Build log:
Error: EBADF: bad file descriptor, fstat
at tryStatSync (node:fs:391:25)
at readFileSync (node:fs:447:17)
at getSourceSync (node:internal/modules/esm/load:37:14)
at createCJSModuleWrap (node:internal/modules/esm/translators:210:32)
...
Works fine on Node v24.14.1, fails on v24.15.0.
Suggested fix
Widen the version gate in packages/yarnpkg-pnp/sources/esm-loader/loaderFlags.ts to also cover Node 24.15+:
changed the title [-]fix: HAS_BROKEN_FSTAT_FOR_ZIP_FDS version gate should include Node 24.15+[/-][+][BUG] HAS_BROKEN_FSTAT_FOR_ZIP_FDS version gate should include Node 24.15+[/+]on Apr 16, 2026
Is this still happening to anyone else with yarn 4.14.1 on node v24.15 and >=25.7?
I have to set my engines.node to >=18.0 <24.15 || >=25.0 <25.7 and use a strict node version check script in my .yarnrc.yml to guarantee compatibility without confusing errors.
The following error occurs when running mocha with yarn.
Mocha is its latest version, v11.7.5:
λ yarn -v
4.14.1
λ yarn mocha --exit --require ts-node/register/transpile-only --require source-map-support/register --recursive \"./test/*.spec.ts\" --timeout 30000
node:fs:391
const stats = binding.fstat(fd, false, undefined, true /* shouldNotThrow */);
^
Error: EBADF: bad file descriptor, fstat
at tryStatSync (node:fs:391:25)
at readFileSync (node:fs:447:17)
at getSourceSync (node:internal/modules/esm/load:37:14)
at createCJSModuleWrap (node:internal/modules/esm/translators:210:32)
at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:349:10)
at #translate (node:internal/modules/esm/loader:451:20)
at afterLoad (node:internal/modules/esm/loader:507:29)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:512:12)
at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:555:36)
at afterResolve (node:internal/modules/esm/loader:603:52) {
errno: -4083,
code: 'EBADF',
syscall: 'fstat'
}
Node.js v24.15.0
Error: EBADF: bad file descriptor, fstat
at tryStatSync (node:fs:391:25)
at readFileSync (node:fs:447:17)
at getSourceSync (node:internal/modules/esm/load:37:14)
at createCJSModuleWrap (node:internal/modules/esm/translators:210:32)
at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:349:10)
at #translate (node:internal/modules/esm/loader:451:20)
at afterLoad (node:internal/modules/esm/loader:507:29)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:512:12)
at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:555:36)
at afterResolve (node:internal/modules/esm/loader:603:52) {
errno: -4083,
code: 'EBADF',
syscall: 'fstat'
}`
Activity
mhassan1 commentedon Apr 16, 2026
Duplicate of #7102 (which seems like it was closed prematurely)
fix: widen EBADF fstat version gate to include Node 24.15+
[-]fix: HAS_BROKEN_FSTAT_FOR_ZIP_FDS version gate should include Node 24.15+[/-][+][BUG] HAS_BROKEN_FSTAT_FOR_ZIP_FDS version gate should include Node 24.15+[/+]fix: Widen EBADF fstat version gate to include Node 24.15+ (#7104)
arcanis commentedon Apr 17, 2026
Indeed I completely forgot this would need to be updated. This is fixed in 4.14.1
brandonbothell commentedon Apr 22, 2026
Is this still happening to anyone else with yarn 4.14.1 on node v24.15 and >=25.7?
I have to set my engines.node to
>=18.0 <24.15 || >=25.0 <25.7and use a strict node version check script in my.yarnrc.ymlto guarantee compatibility without confusing errors.The following error occurs when running
mochawithyarn.Mocha is its latest version,
v11.7.5:shankar-krishna commentedon May 2, 2026
Still facing same with yarn version 4.14.1 and node 24.15.0.
`# This file contains the result of Yarn building a package (unrs-resolver@npm:1.11.1)
Script name: postinstall
node:fs:391
const stats = binding.fstat(fd, false, undefined, true /* shouldNotThrow */);
^
Error: EBADF: bad file descriptor, fstat
at tryStatSync (node:fs:391:25)
at readFileSync (node:fs:447:17)
at getSourceSync (node:internal/modules/esm/load:37:14)
at createCJSModuleWrap (node:internal/modules/esm/translators:210:32)
at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:349:10)
at #translate (node:internal/modules/esm/loader:451:20)
at afterLoad (node:internal/modules/esm/loader:507:29)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:512:12)
at #getOrCreateModuleJobAfterResolve (node:internal/modules/esm/loader:555:36)
at afterResolve (node:internal/modules/esm/loader:603:52) {
errno: -4083,
code: 'EBADF',
syscall: 'fstat'
}`
Pin CI to Node 24.14.1 (#1835)
Pin CI to Node 24.14.1 (#1835)