emberjs/ember.js · error · Error

`eq` expects exactly two arguments, but received ${arguments

Error message

`eq` expects exactly two arguments, but received ${arguments.length}.

What it means

The `eq` helper performs a strict equality comparison (left === right) in Glimmer templates. This debug-only guard throws when the helper receives an argument count other than exactly two, which normally only happens when the helper is misused from JavaScript (e.g. called directly instead of through the template helper machinery) rather than from a template.

Source

Thrown at packages/@glimmer/runtime/lib/helpers/eq.ts:10

import { DEBUG } from '@glimmer/env';

/**
 * Performs a strict equality comparison.
 *
 * left === right
 */
export function eq(left: unknown, right: unknown) {
  if (DEBUG && arguments.length !== 2) {
    throw new Error(`\`eq\` expects exactly two arguments, but received ${arguments.length}.`);
  }

  return left === right;
}

View on GitHub (pinned to 26f97246a8)

Solutions

  1. Call the helper from templates as `{{eq a b}}` with exactly two arguments
  2. If calling from JS, wrap arguments so exactly two are passed: `eq(a, b)`
  3. Ensure any wrapper forwards `positional.length === 2` before invoking eq

Example fix

// before
import { eq } from '@glimmer/runtime';
eq(a);
// after
eq(a, b);
Defensive patterns

Strategy: validation

Validate before calling

function safeEq(...args) { if (args.length !== 2) throw new TypeError('eq requires exactly two arguments'); return eq(args[0], args[1]); }

Type guard

function hasTwoArgs<T extends unknown[]>(args: T): args is T & { length: 2 } { return args.length === 2; }

Try / catch

try { result = eq(a, b); } catch (e) { console.error('eq arity error:', e.message); result = false; }

Prevention

When it happens

Trigger: Calling `eq()` directly from JS with 1 or 3+ arguments; a custom helper/curry pipeline invoking eq with a malformed positional args array; helper invoked programmatically without the two positional arguments the template syntax `{{eq a b}}` guarantees.

Common situations: Refactoring a template helper call into a direct JS call; wrapping eq in a custom helper and forgetting to forward both positional args; test code importing the internal helper and calling it with partial arguments.

Related errors


AI-assisted analysis of emberjs/ember.js@26f97246a8 (2026-09-01). Data as JSON: /api/errors/b76f27ccf6c82efc. Report an issue: GitHub.