ERR_FALSY_VALUE_REJECTION
Node.jsWARNINGNotableAsyncHIGH confidence

Promise rejected with a falsy value

Production Risk

Low — causes confusing error wrapping; always use Error objects for rejections.

What this means

Thrown when a Promise is rejected with a falsy value (null, undefined, 0, false, or empty string) and that rejection is converted to an error by Node.js utilities such as util.callbackify(). Since Node.js error conventions require Errors as rejection reasons, falsy rejections must be wrapped.

Why it happens
  1. 1Calling reject(null) or reject(undefined) in a Promise constructor
  2. 2A function returning a rejected Promise with a non-Error value
  3. 3Using util.callbackify() on a function that rejects with falsy values
How to reproduce

Triggered by util.callbackify() when the promisified function rejects with a falsy value.

trigger — this will error
trigger — this will error
const { callbackify } = require('util');
async function badFn() { throw null; } // falsy rejection
const cbFn = callbackify(badFn);
cbFn((err) => {
  console.error(err.code); // ERR_FALSY_VALUE_REJECTION
  console.error(err.reason); // null
});

expected output

Error [ERR_FALSY_VALUE_REJECTION]: Promise was rejected with falsy value

Fix 1

Always reject Promises with Error instances

WHEN When creating or returning rejected Promises

Always reject Promises with Error instances
async function goodFn() {
  throw new Error('Something went wrong'); // proper Error
}

Why this works

Rejecting with an Error instance satisfies util.callbackify() and all Node.js error conventions.

Fix 2

Handle the wrapped error in callbackify callbacks

WHEN When working with third-party code that may reject with falsy values

Handle the wrapped error in callbackify callbacks
cbFn((err) => {
  if (err && err.code === 'ERR_FALSY_VALUE_REJECTION') {
    console.warn('Received falsy rejection:', err.reason);
    return;
  }
  if (err) throw err;
});

Why this works

Checking for ERR_FALSY_VALUE_REJECTION lets you handle the wrapped error appropriately.

Code examples
Triggerjs
const { callbackify } = require('util');
async function badFn() { throw null; } // falsy rejection
const cbFn = callbackify(badFn);
cbFn((err) => {
  console.error(err.code); // ERR_FALSY_VALUE_REJECTION
  console.error(err.reason); // null  // this triggers ERR_FALSY_VALUE_REJECTION
Handle in try/catchjs
try {
  // operation that may throw ERR_FALSY_VALUE_REJECTION
  riskyOperation()
} catch (err) {
  if (err.code === 'ERR_FALSY_VALUE_REJECTION') {
    console.error('ERR_FALSY_VALUE_REJECTION:', err.message)
  } else {
    throw err
  }
}
Defensive pattern to avoid itjs
// Validate inputs before calling the operation
function safe_err_falsy_value_rejection(...args) {
  // validate args here
  return performOperation(...args)
}
What not to do

Reject Promises with null, undefined, or other falsy values

Falsy rejections break error-handling conventions and require special handling in callbackify.

Sources
Official documentation ↗

Node.js Error Codes Documentation

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Node.js errors