nodejs / nodejs/node

EBADF fstat error with 25.7.0 but not 25.6.1

Open
#62,012 25 comments 14 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

loaders
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

25.7.0

Platform
Alpine 3.23
Subsystem

No response

What steps will reproduce the bug?

Both Cypress and ESLint using Yarn 4.12.0, have the error:

node:internal/event_target:1118
  process.nextTick(() => { throw err; });
                           ^
Error: EBADF: bad file descriptor, fstat
    at tryStatSync (node:fs:386:25)
    at readFileSync (node:fs:442:17)
    at getSourceSync (node:internal/modules/esm/load:37:14)
    at createCJSModuleWrap (node:internal/modules/esm/translators:204:32)
    at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:343: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: -9,
  code: 'EBADF',
  syscall: 'fstat'
}

Node.js v25.7.0

It is not an issue when installing Cypress or running ESLint with Node 25.6.1

How often does it reproduce? Is there a required condition?

Every time

What is the expected behavior? Why is that the expected behavior?

Running ESLint or installing Cypress should not reproduce the error.

What do you see instead?

Installed without errors for Cypress, Lints without errors for ESLint.

Additional information

At first I thought it was an issue with Cypress until I ran ESLint.
https://github.com/cypress-io/cypress/issues/33418

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure on Alpine 3.23 with Node.js 25.7.0, Yarn 4.12.0, Cypress, or ESLint, then compare with 25.6.1. Start at the node:fs fstat stack and the mentioned internal/modules/esm/load and internal/modules/esm/loader entry points. Done means the reproducible EBADF error no longer occurs while installing Cypress or running ESLint.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, linux, node.js
Domain
backend, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.