Skip to content
Latchkey

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.

Node output
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.

Terminal
rm -rf node_modules
npm cache verify
npm ci
npm rebuild

Move to a current Node LTS patch

  1. Note the Node version in the failing job (node --version).
  2. Upgrade to the latest patch of your LTS line in case the assertion is a fixed Node bug.
  3. If it persists with a reproducible stack, capture it and report upstream.

How to prevent it

  • Run a clean npm ci so module state is never half-written.
  • Keep Node on a current LTS patch in CI.
  • Rebuild native addons against the runner’s Node ABI.

Frequently asked questions

Is this really always a Node bug?
Not in practice. The message is generic; in CI the usual triggers are a corrupted native module or a partial install. Try a clean reinstall and a current Node patch before assuming a genuine Node defect.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →