Skip to content
Latchkey

Node DeprecationWarning Treated as Error in CI - Stop the Failing Warning

Node deprecation warnings are advisory by default, but --throw-deprecation upgrades them to thrown errors, so a deprecated API call crashes the job.

What this error means

A CI step exits non-zero on a DeprecationWarning, with a stack rather than a plain warning line, because the process was started with --throw-deprecation.

node
node:internal/process/warning:130
      throw warning;
      ^

DeprecationWarning: The `util.isArray` API is deprecated. Please use
`Array.isArray()` instead.
    at emitDeprecationWarning (node:internal/util:80:11)

Common causes

--throw-deprecation is enabled

A flag or NODE_OPTIONS in CI turns deprecation warnings into thrown errors, so any deprecated API aborts the run.

Code or a dependency uses a deprecated API

A removed-soon API is still being called, and with throw-on-deprecation that call becomes fatal.

How to fix it

Replace the deprecated API

  1. Read the warning to identify the deprecated call.
  2. Switch to the recommended replacement.
  3. Re-run to confirm the warning no longer fires.
JavaScript
Array.isArray(value); // instead of util.isArray(value)

Drop the throw-deprecation flag if intentional warnings remain

  1. Remove --throw-deprecation from NODE_OPTIONS or the run command.
  2. Address the underlying deprecated calls separately.

How to prevent it

  • Keep --throw-deprecation off in CI unless you are deliberately auditing, fix deprecated API usage promptly, and watch dependency upgrade notes for newly deprecated calls.

Frequently asked questions

What causes ""DeprecationWarning (treated as error)""?
A flag or NODE_OPTIONS in CI turns deprecation warnings into thrown errors, so any deprecated API aborts the run.
How do I fix "DeprecationWarning (treated as error)"?
Replace the deprecated API

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card