emberjs/ember.js · error · Error

`gte` expects exactly two arguments, but received ${argument

Error message

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

What it means

The `gte` helper performs a greater-than-or-equal comparison (left >= right) in templates. A debug-only arity guard throws when the helper does not receive exactly two arguments, which only occurs when it is invoked outside the normal template path with a malformed argument list.

Source

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

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

/**
 * Performs a greater than or equal comparison.
 *
 * left >= right
 */
export function gte<T>(left: T, right: T) {
  if (DEBUG && arguments.length !== 2) {
    throw new Error(`\`gte\` expects exactly two arguments, but received ${arguments.length}.`);
  }

  return (left as number) >= (right as number);
}

View on GitHub (pinned to 26f97246a8)

Solutions

  1. Use `{{gte a b}}` in templates with exactly two arguments
  2. When calling from JS, pass exactly two arguments: `gte(a, b)`
  3. Add an arity assertion in any wrapper before delegating to gte

Example fix

// before
gte(total);
// after
gte(total, 100);
Defensive patterns

Strategy: validation

Validate before calling

function safeGte(...args) { if (args.length !== 2) throw new TypeError('gte requires exactly two arguments'); return gte(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 = gte(a, b); } catch (e) { console.error('gte arity error:', e.message); result = false; }

Prevention

When it happens

Trigger: Direct JS call to `gte()` with 1 or 3+ arguments; custom helper/wrapper forwarding wrong positional count; programmatic invocation omitting required positional arguments.

Common situations: Unit tests importing internal helpers; refactoring template logic into JS utilities; generic argument-forwarding helpers miscounting positional params.

Related errors


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