emberjs/ember.js · error · Error

You must pass a valid DOM event name as the first argument t

Error message

You must pass a valid DOM event name as the first argument to the `on` modifier on ${selector}

What it means

Error "You must pass a valid DOM event name as the first argument to the `on` modifier on ${selector}" thrown in emberjs/ember.js.

Source

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

    if (DEBUG) {
      const el = this.element;
      selector =
        el.tagName.toLowerCase() +
        (el.id ? `#${el.id}` : '') +
        Array.from(el.classList)
          .map((c) => `.${c}`)
          .join('');
    }

    let arg0 = args.positional[0];
    let eventName = check(
      arg0 ? valueForRef(arg0) : undefined,
      CheckString,
      () => 'You must pass a valid DOM event name as the first argument to the `on` modifier'
    );

    if (DEBUG && !eventName) {
      throw new Error(
        `You must pass a valid DOM event name as the first argument to the \`on\` modifier on ${selector}`
      );
    }

    let arg1 = args.positional[1];
    let userProvidedCallback = check(
      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 ${

View on GitHub (pinned to 26f97246a8)

When it happens

Trigger: Thrown at packages/@glimmer/runtime/lib/modifiers/on.ts:79 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/4ce3688f7612446e. Report an issue: GitHub.