emberjs/ember.js · error · Error
You must pass a function as the second argument to the `on`
Error message
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} What it means
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}" thrown in emberjs/ember.js.
Source
Thrown at packages/@glimmer/runtime/lib/modifiers/on.ts:96
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 ${
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);View on GitHub (pinned to 26f97246a8)
When it happens
Trigger: Thrown at packages/@glimmer/runtime/lib/modifiers/on.ts:96 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/b084bc5c6235b8cd.
Report an issue: GitHub.