emberjs/ember.js · error · Error

You can only pass two positional arguments (event name and c

Error message

You can only pass two positional arguments (event name and callback) to the `on` modifier, but you provided ${args.positional.length}. Consider using the `fn` helper to provide additional arguments to the `on` callback on ${selector}

What it means

Error "You can only pass two positional arguments (event name and callback) to the `on` modifier, but you provided ${args.positional.length}. Consider using the `fn` helper to provide additional arguments to the `on` callback on ${selector}" thrown in emberjs/ember.js.

Source

Thrown at packages/@glimmer/runtime/lib/modifiers/on.ts:104

      arg1 ? valueForRef(arg1) : undefined,
      CheckFunction,
      (actual) => {
        return `You must pass a function as the second argument to the \`on\` modifier; you passed ${
          actual === null ? 'null' : typeof actual
        }. While rendering:\n\n${args.positional[1]?.debugLabel ?? `{unlabeled value}`}`;
      }
    ) as EventListener;

    if (DEBUG && typeof userProvidedCallback !== 'function') {
      throw new Error(
        `You must pass a function as the second argument to the \`on\` modifier; you passed ${
          userProvidedCallback === null ? 'null' : typeof userProvidedCallback
        }. While rendering:\n\n${args.positional[1]?.debugLabel ?? '(unknown)'} on ${selector}`
      );
    }

    if (DEBUG && args.positional.length !== 2) {
      throw new Error(
        `You can only pass two positional arguments (event name and callback) to the \`on\` modifier, but you provided ${args.positional.length}. Consider using the \`fn\` helper to provide additional arguments to the \`on\` callback on ${selector}`
      );
    }

    let once: boolean | undefined = undefined;
    let passive: boolean | undefined = undefined;
    let capture: boolean | undefined = undefined;

    if (DEBUG) {
      let { once: _once, passive: _passive, capture: _capture, ...extra } = reifyNamed(args.named);

      once = check(_once, CheckOr(CheckBoolean, CheckUndefined), (actual) => {
        return `You must pass a boolean or undefined as the \`once\` argument to the \`on\` modifier; you passed ${actual}. While rendering:\n\n${
          // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
          args.named['once']!.debugLabel ?? `{unlabeled value}`
        }`;
      });

View on GitHub (pinned to 26f97246a8)

When it happens

Trigger: Thrown at packages/@glimmer/runtime/lib/modifiers/on.ts:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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