Skip to content

[Bug?]: EBADF with Node22 on Ubuntu and macOS #7211

Description

@jkowalleck

Self-service

  • I'd be willing to implement a fix

Describe the bug

with yarn 4.17.0 I see EBADF errors with

node:internal/modules/run_main:123
    triggerUncaughtException(
    ^
Error: EBADF: bad file descriptor, fstat
    at tryStatSync (node:fs:390:25)
    at readFileSync (node:fs:446:17)
    at getSourceSync (node:internal/modules/esm/load:41:14)
    at defaultLoad (node:internal/modules/esm/load:92:34)
    at nextLoad (node:internal/modules/esm/hooks:748:28)
    at load$1 (file:///Users/runner/work/playground_yarn4_EBADF_tests/playground_yarn4_EBADF_tests/.pnp.loader.mjs:1526:12)
    at nextLoad (node:internal/modules/esm/hooks:748:28)
    at Hooks.load (node:internal/modules/esm/hooks:385:26)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:199:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:843:20) {
  errno: -9,
  code: 'EBADF',
  syscall: 'fstat'
}

no such error seen with

  • Node.js v22.23.1 on Windows
  • Node 26 on all tested OS
  • Node 24 on all tested OS
  • Node 20 on all tested OS

To reproduce

  1. use Node 22
  2. git clone https://github.com/jkowalleck/playground_yarn4_EBADF_tests/
  3. cd into git clone
  4. run yarn install --immutable
  5. run yarn run test

Environment

<https://github.com/jkowalleck/playground_yarn4_EBADF_tests/actions/runs/28929465180/job/85824773532#step:7:6>
  System:
    OS: Linux 6.17 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (4) x64 AMD EPYC 7763 64-Core Processor
  Binaries:
    Node: 22.23.1 - /tmp/xfs-48663a3d/node
    Yarn: 4.17.0 - /tmp/xfs-48663a3d/yarn
    npm: 10.9.8 - /opt/hostedtoolcache/node/22.23.1/x64/bin/npm


----

<https://github.com/jkowalleck/playground_yarn4_EBADF_tests/actions/runs/28929465180/job/85824773495#step:7:6>
  System:
    OS: macOS 15.7.7
    CPU: (3) arm64 Apple M1 (Virtual)
  Binaries:
    Node: 22.23.1 - /private/var/folders/k8/j7r3p6cx43xdqhzy2rmp6tqr0000gn/T/xfs-6052f5ca/node
    Yarn: 4.17.0 - /private/var/folders/k8/j7r3p6cx43xdqhzy2rmp6tqr0000gn/T/xfs-6052f5ca/yarn
    npm: 10.9.8 - /Users/runner/hostedtoolcache/node/22.23.1/arm64/bin/npm

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions