Verified Production Fix
[nodejs/node] Error [ERR_INTERNAL_ASSERTION]: Unexpected module status 0. Cannot require() ES Module ... because it is not yet fully loaded.
GH-nodejs/node#62130 • Mar 08, 2026
### ROOT CAUSE
The issue arises from attempting to require an ES module directly in a CommonJS context, which is not supported. The error message indicates that the module is not yet fully loaded, likely due to a race condition when using `Promise.all()` to import multiple modules simultaneously.
### CODE FIX
To resolve this issue, you should await the import of each module sequentially instead of using `Promise.all()`. This ensures that each module is fully loaded before the next one is imported.
Here's how you can modify your code:
// Sequentially import modules instead of using Promise.all()
(async () => {
const module1 = await import('module1');
const module2 = await import('module2');
// Continue importing other modules sequentially
})();
If you are using a testing framework like Jest, you can apply this fix in your test setup or within the test itself. For example:
// In your Jest test setup file (e.g., jest.config.js)
module.exports = {
setupFilesAfterEnv: [
async () => {
const module1 = await import('module1');
const module2 = await import('module2');
// Continue importing other modules sequentially
}
]
};
Alternatively, if you are importing modules within a test file, you can do it sequentially:
// In your test file
describe('ESM Import Test', async () => {
let module1, module2;
beforeAll(async () => {
module1 = await import('module1');
module2 = await import('module2');
// Continue importing other modules sequentially
});
test('Test with module1', () => {
// Use module1 in your test
});
test('Test with module2', () => {
// Use module2 in your test
});
});
By ensuring that each module is fully loaded before the next one is imported, you can avoid the race condition and resolve the `ERR_INTERNAL_ASSERTION` error.
Deploy with Vultr
Use this fix in production instantly. Claim your high-performance developer credit.
Get Started with Vultr →
digital