Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Error [ERR_INTERNAL_ASSERTION]: Unexpected module status 0. Cannot require() ES Module ... because it is not yet fully loaded. | GoodFirstPicks

Error [ERR_INTERNAL_ASSERTION]: Unexpected module status 0. Cannot require() ES Module ... because it is not yet fully loaded.

nodejs/node 1 comments 25d ago
View on GitHub
highopenScope: somewhat clearSkill match: maybeTest focusedNode.jsJavaScript

Why this is a good first issue

The issue involves a race condition in ESM/CJS interoperability and requires deep Node.js internals knowledge.

AI Summary

The issue involves a race condition when dynamically importing an ES module via `require()` in Node.js, causing an internal assertion error. The problem is reproducible and tied to specific import patterns. Fixing it likely requires understanding Node.js's ESM/CJS interoperability internals and addressing the race condition.

Issue Description

Version

25.8.0

Platform

Linux nic-desktop 6.17.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan  9 17:01:16 UTC 2026 x86_64 GNU/Linux

Subsystem

require(esm)

What steps will reproduce the bug?

  1. Clone https://github.com/nicolo-ribaudo/babel-polyfills/tree/nodejs-bug
  2. Run yarn && yarn build
  3. Run yarn jest es-shims

Note that this is not using Jest's vm-based ESM support. It's using jest-light-runner to run directly in native Node.js ESM.

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

Consistently. Note that if I run only one test (yarn jest es-shims -t "tepmlate tag") it does not fail.

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

That it does not tell me to submit a bug report :P

What do you see instead?

    Error [ERR_INTERNAL_ASSERTION]: [BABEL]: Unexpected module status 0. Cannot require() ES Module /home/nic/Documents/dev/github.com/babel/babel-polyfills/packages/babel-plugin-polyfill-es-shims/lib/index.js because it is not yet fully loaded.
    This may be caused by a race condition if the module is simultaneously dynamically import()-ed via Promise.all().
    Try await-ing the import() sequentially in a loop instead.
     (From /home/nic/Documents/dev/github.com/babel/babel-polyfills/packages/babel-plugin-polyfill-es-shims/test/node_modules/@@/babel-plugin-polyfill-es-shims.js in non-loader-hook thread)
    This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
    Please open an issue with this stack trace at https://github.com/nodejs/node/issues
     (While processing: /home/nic/Documents/dev/github.com/babel/babel-polyfills/packages/babel-plugin-polyfill-es-shims/test/node_modules/@@/babel-plugin-polyfill-es-shims.js)
        at assert.fail (node:internal/assert:17:9)
        at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:358:16)
        at loadESMFromCJS (node:internal/modules/cjs/loader:1620:24)
   

GitHub Labels

esm

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 35 points when you complete it!

Risk Flags

  • race condition
  • ESM/CJS interoperability
  • internal Node.js assertion
Loading labels...

Details

Points35 pts
Difficultyhigh
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes