denoland/deno · error · TypeError

ERR_MISSING_ARGS

ERR_MISSING_ARGS

Error message

The "actual" and "expected" arguments must be specified

What it means

assert.equal (loose == comparison) requires both actual and expected arguments. The arity guard at the top of the function raises ERR_MISSING_ARGS when fewer than two arguments are supplied, before any comparison happens.

Source

Thrown at ext/node/polyfills/assert.ts:520

  ...args
) {
  expectsError(throws, getActual(fn), ...new SafeArrayIterator(args));
}

function doesNotThrow(
  fn,
  ...args
) {
  expectsNoError(doesNotThrow, getActual(fn), ...new SafeArrayIterator(args));
}

function equal(
  actual,
  expected,
  message,
) {
  if (arguments.length < 2) {
    throw new ERR_MISSING_ARGS("actual", "expected");
  }

  if (
    actual != expected && (!NumberIsNaN(actual) || !NumberIsNaN(expected))
  ) {
    innerFail({
      actual,
      expected,
      message,
      operator: "==",
      stackStartFn: equal,
      diff: this?.[kOptions]?.diff,
    });
  }
}

function notEqual(
  actual,

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Supply both arguments: assert.equal(actual, expected)
  2. Guard the call when the value may be legitimately absent: if (value !== undefined) assert.equal(value, expected)
  3. Fix the data source so the compared value is defined

Example fix

// before
assert.equal(config.retryLimit);
// after
assert.equal(config.retryLimit, 3);
Defensive patterns

Strategy: validation

Validate before calling

if (actual === undefined) throw new Error('actual value is missing');
assert.equal(actual, expected);

Try / catch

try { assert.equal(a, e); } catch (e) { if (e.code === 'ERR_MISSING_ARGS') throw new Error('supply both actual and expected'); throw e; }

Prevention

When it happens

Trigger: assert.equal(value) with only one argument; assert.equal(undefined) where a config value turned out to be undefined and the expected argument was never written.

Common situations: Optional config or environment values that are undefined at runtime; test helpers that forward optional parameters; refactors that removed a parameter but left the assert call intact.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/021c3622d345b717. Report an issue: GitHub.