Skip to content
Latchkey

Node "ERR_INTERNAL_ASSERTION" in CI

Node hit an internal invariant it assumes is always true and aborted with ERR_INTERNAL_ASSERTION. This signals a Node bug or a native module poking at internals incompatibly - not your application logic.

What this error means

A run crashes with "ERR_INTERNAL_ASSERTION: This is caused by either a bug in Node.js or incorrect usage of Node.js internals". It often correlates with a specific Node patch release or a native dependency.

node
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

Common causes

A bug in the pinned Node version

Certain Node patch releases shipped regressions that trip internal assertions under specific workloads.

A native addon using internals

A compiled module built against a different Node ABI reaches into internals incompatibly.

How to fix it

Move to a patched Node release

Pin to a Node version known to fix the assertion, often the latest patch of your major line.

workflow
# workflow
node-version: 20.x  # use the latest patch on your major

Rebuild native addons for the active Node

Reinstall or rebuild native modules so their ABI matches the running Node.

Terminal
npm rebuild
# or fully reinstall
rm -rf node_modules && npm ci

How to prevent it

  • Track Node patch releases and avoid known-bad versions.
  • Rebuild native addons whenever the Node version changes.
  • Keep a single Node version across build and runtime.

Related guides

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