Node.js ERR_INTERNAL_ASSERTION - Fix "This is caused by a bug in Node.js"
ERR_INTERNAL_ASSERTION means Node hit an internal consistency check it never expects to fail. The message itself says it is a Node bug - but in CI it is most often triggered by a corrupted native addon, a half-written install, or a Node version with a known regression.
What this error means
A process aborts with Error [ERR_INTERNAL_ASSERTION] and a note that it is caused by a bug in Node.js, asking you to open an issue. It can be intermittent - a flaky native module or a partially restored cache reproduces it on some runs and not others.
Error [ERR_INTERNAL_ASSERTION]: 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
at assert (node:internal/assert)
code: 'ERR_INTERNAL_ASSERTION'Common causes
A corrupted or mismatched native addon
A .node binary built against a different Node ABI, or a half-downloaded native dependency, can drive Node into an internal state it asserts against.
A partially-written install or restored cache
An interrupted npm ci or a restored stale node_modules/cache can leave Node loading inconsistent module state, tripping the assertion.
A known Node-version bug
Some Node patch releases shipped internal-assertion regressions in specific subsystems; moving to a current LTS patch sidesteps them.
How to fix it
Reinstall cleanly and rebuild natives
Rebuild from a clean tree so a corrupted addon or partial install is replaced.
rm -rf node_modules
npm cache verify
npm ci
npm rebuildMove to a current Node LTS patch
- Note the Node version in the failing job (
node --version). - Upgrade to the latest patch of your LTS line in case the assertion is a fixed Node bug.
- If it persists with a reproducible stack, capture it and report upstream.
How to prevent it
- Run a clean
npm ciso module state is never half-written. - Keep Node on a current LTS patch in CI.
- Rebuild native addons against the runner’s Node ABI.