Title: `ERR_INTERNAL_ASSERTION` when `import()` and `require()` load the same ESM dependency · Issue #62432 · nodejs/node · GitHub
Open Graph Title: `ERR_INTERNAL_ASSERTION` when `import()` and `require()` load the same ESM dependency · Issue #62432 · nodejs/node
X Title: `ERR_INTERNAL_ASSERTION` when `import()` and `require()` load the same ESM dependency · Issue #62432 · nodejs/node
Description: Version v24.14.0 Platform Darwin parksb 24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:37 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6031 arm64 Subsystem No response What steps will reproduce the bug? Create an ESM-only pack...
Open Graph Description: Version v24.14.0 Platform Darwin parksb 24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:37 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6031 arm64 Subsystem No response What steps will re...
X Description: Version v24.14.0 Platform Darwin parksb 24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:37 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6031 arm64 Subsystem No response What steps will re...
Opengraph URL: https://github.com/nodejs/node/issues/62432
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`ERR_INTERNAL_ASSERTION` when `import()` and `require()` load the same ESM dependency","articleBody":"### Version\n\nv24.14.0\n\n### Platform\n\n```text\nDarwin parksb 24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:37 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6031 arm64\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\n1. Create an ESM-only package called `esm-dep`.\n1. Create a dual package called `dual-pkg` with conditional exports where the `\"import\"` entry (`esm.mjs`) does `import \"esm-dep\"` and the `\"require\"` entry (`cjs.js`) does `require(\"esm-dep\")`.\n1. Create a CJS package called `cjs-pkg` that does `require(\"dual-pkg\")`.\n1. Then run a CJS script that calls `import(\"dual-pkg\")` and `require(\"cjs-pkg\")` in the same synchronous tick.\n\n```js\n// index.cjs\nimport(\"dual-pkg\");\nrequire(\"cjs-pkg\");\n```\n\nA minimal reproduction is available at: https://github.com/parksb/nodejs-node-issue-62432\n\n```\n$ git clone https://github.com/parksb/nodejs-node-issue-62432.git\n$ cd nodejs-node-issue\n$ npm install\n$ nvm use 22\n$ node index.cjs # no error\n$ nvm use 24\n$ node index.cjs # ERR_INTERNAL_ASSERTION\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways reproduces on v24.x. The repository includes `.nvmrc` pinned to v24.14.0. Switching to Node 22.x (`nvm use 22`) and re-running `node index.cjs` succeeds without error.\n\nThe required condition is that `import()` and `require()` resolve to different entry points of the same dual package (via conditional exports), and both entry points depend on the same ESM-only package (`esm-dep`). The two calls must happen in the same synchronous tick, with no `await` between them.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nNo error. Both `import()` and `require()` should be able to load `esm-dep`. `require(esm)` has been supported since Node 22.12.0 for synchronous graphs without top-level await.\n\n### What do you see instead?\n\n```\nnode:internal/assert:17\n throw new ERR_INTERNAL_ASSERTION(message);\n ^\n\nError [ERR_INTERNAL_ASSERTION]: Unexpected module status 0. Cannot require() ES Module /Users/parksb/nodejs-node-issue/esm-dep/index.js because it is not yet fully loaded.\nThis may be caused by a race condition if the module is simultaneously dynamically import()-ed via Promise.all().\nTry await-ing the import() sequentially in a loop instead.\n (From /Users/parksb/nodejs-node-issue/dual-pkg/cjs.js in non-loader-hook thread)\nThis is caused by either a bug in Node.js or incorrect usage of Node.js internals.\nPlease open an issue with this stack trace at https://github.com/nodejs/node/issues\n\n at assert.fail (node:internal/assert:17:9)\n at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:364:16)\n at loadESMFromCJS (node:internal/modules/cjs/loader:1629:24)\n at Module._compile (node:internal/modules/cjs/loader:1794:5)\n at Object..js (node:internal/modules/cjs/loader:1943:10)\n at Module.load (node:internal/modules/cjs/loader:1533:32)\n at Module._load (node:internal/modules/cjs/loader:1335:12)\n at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)\n at Module.require (node:internal/modules/cjs/loader:1556:12)\n at require (node:internal/modules/helpers:152:16) {\n code: 'ERR_INTERNAL_ASSERTION'\n}\n\nNode.js v24.14.1\n```\n\n### Additional information\n\nThese might be related: \n- https://github.com/nodejs/node/issues/55782\n- https://github.com/nodejs/node/pull/60380","author":{"url":"https://github.com/parksb","@type":"Person","name":"parksb"},"datePublished":"2026-03-25T11:52:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/62432/node/issues/62432"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b43821b5-4d7e-253d-6df5-23a048dbb2c2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A552:1EF1:2A1E1FF:3BFB943:6A4D0158 |
| html-safe-nonce | 046cadc59aedd4e459ff4d168b45fcd9fd670f03b47ca1ed80dd50420af3233c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTUyOjFFRjE6MkExRTFGRjozQkZCOTQzOjZBNEQwMTU4IiwidmlzaXRvcl9pZCI6IjQ1NjI3NjEyNTMxNzMxMzM2NTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d6c51a491fec6eb4052dead471d5000b510add84e34349ad68ce97ea6744bfc9 |
| hovercard-subject-tag | issue:4134842123 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/62432/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3f639366b6d8a4ede2f8f41dd069acaaa8792e84284bc2f4ace1efa48aa04ae8/nodejs/node/issues/62432 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3f639366b6d8a4ede2f8f41dd069acaaa8792e84284bc2f4ace1efa48aa04ae8/nodejs/node/issues/62432 |
| og:image:alt | Version v24.14.0 Platform Darwin parksb 24.4.0 Darwin Kernel Version 24.4.0: Wed Mar 19 21:17:37 PDT 2025; root:xnu-11417.101.15~1/RELEASE_ARM64_T6031 arm64 Subsystem No response What steps will re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | parksb |
| hostname | github.com |
| expected-hostname | github.com |
| None | 31e4db13a9e20081f2fac78f441659a6576e582bbb15e153f9c7fb6473aa29f5 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width