Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error [ERR_INTERNAL_ASSERTION]: This is caused by either a bug in Node.js or incorrect usage of Node.js internals. #54773

Closed
Mongsplaatjies opened this issue Sep 4, 2024 · 7 comments · Fixed by #54868
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation. strip-types Issues or PRs related to strip-types support

Comments

@Mongsplaatjies
Copy link

Version

Node.js v22.7.0

Platform

at assert (node:internal/assert:14:11)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:329:5)     
    at new ModuleJobSync (node:internal/modules/esm/module_job:313:34)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:314:11)      
    at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)
    at Module._compile (node:internal/modules/cjs/loader:1503:5)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
    at Module._load (node:internal/modules/cjs/loader:1127:12)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14) {
  code: 'ERR_INTERNAL_ASSERTION'
}

Subsystem

No response

What steps will reproduce the bug?

at assert (node:internal/assert:14:11)
at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:329:5)
at new ModuleJobSync (node:internal/modules/esm/module_job:313:34)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:314:11)
at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)
at Module._compile (node:internal/modules/cjs/loader:1503:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
at Module.load (node:internal/modules/cjs/loader:1317:32)
at Module._load (node:internal/modules/cjs/loader:1127:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14) {
code: 'ERR_INTERNAL_ASSERTION'
}

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

Fisrt time

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

image

What do you see instead?

image

Additional information

No response

@RedYetiDev RedYetiDev added the invalid Issues and PRs that are invalid. label Sep 4, 2024
@RedYetiDev
Copy link
Member

As it currently stands, your issue lacks enough information to be easily reproduced. Please edit your issue to include additional information, such as specific (minimal) code snippets that will allow this issue to be easily reproduced.

@RedYetiDev RedYetiDev added the stalled Issues and PRs that are stalled. label Sep 5, 2024
Copy link
Contributor

github-actions bot commented Sep 5, 2024

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

@RedYetiDev
Copy link
Member

Hey, I've marked this issue as stalled (though that bot doesn't appear to work), just so collaborators know that this issue is waiting for more information.

@aduh95 aduh95 removed the invalid Issues and PRs that are invalid. label Sep 5, 2024
@aduh95
Copy link
Contributor

aduh95 commented Sep 5, 2024

@joyeecheung wdyt? Should we replace the else with else if (getOptionValue('--experimental-require-module')) in

} else {
const {
wrap,
namespace,
} = cascadedLoader.importSyncForRequire(mod, filename, source, isMain, mod[kModuleParent]);

@RedYetiDev RedYetiDev removed the stalled Issues and PRs that are stalled. label Sep 5, 2024
@joyeecheung
Copy link
Member

joyeecheung commented Sep 5, 2024

That function should only be used if the option is turned on in the first place (otherwise it should’ve gone elsewhere to throw ERR_REQUIRE_ESM instead of going into this function), I am not sure whether that solves anything without more information of the repro

@RedYetiDev
Copy link
Member

RedYetiDev commented Sep 5, 2024

I am not sure whether that solves anything without more information of the repro

@Mongsplaatjies can you provide a minimal reproducible example of the code that caused this error?


For reference, the failing assertion is:

assert(getOptionValue('--experimental-require-module'));

@aduh95
Copy link
Contributor

aduh95 commented Sep 9, 2024

I'm able to reproduce thanks to @dgozman with the following script:

rm -rf repro
mkdir repro
cd repro

echo 'import "fs"' > imported.ts
node -e 'require("./imported.ts")'

cd ..
rm -rf repro

@aduh95 aduh95 added confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation. strip-types Issues or PRs related to strip-types support labels Sep 9, 2024
aduh95 added a commit that referenced this issue Sep 12, 2024
PR-URL: #54868
Fixes: #54773
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 added a commit that referenced this issue Sep 13, 2024
PR-URL: #54868
Fixes: #54773
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 added a commit that referenced this issue Sep 13, 2024
PR-URL: #54868
Fixes: #54773
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
louwers pushed a commit to louwers/node that referenced this issue Nov 2, 2024
tpoisseau pushed a commit to tpoisseau/node that referenced this issue Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation. strip-types Issues or PRs related to strip-types support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants