{"record":{"id":"4ce3688f7612446e","repo":"emberjs/ember.js","slug":"you-must-pass-a-valid-dom-event-name-as-the-first","errorCode":null,"errorMessage":"You must pass a valid DOM event name as the first argument to the `on` modifier on ${selector}","messagePattern":"You must pass a valid DOM event name as the first argument to the `on` modifier on (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@glimmer/runtime/lib/modifiers/on.ts","lineNumber":79,"sourceCode":"    if (DEBUG) {\n      const el = this.element;\n      selector =\n        el.tagName.toLowerCase() +\n        (el.id ? `#${el.id}` : '') +\n        Array.from(el.classList)\n          .map((c) => `.${c}`)\n          .join('');\n    }\n\n    let arg0 = args.positional[0];\n    let eventName = check(\n      arg0 ? valueForRef(arg0) : undefined,\n      CheckString,\n      () => 'You must pass a valid DOM event name as the first argument to the `on` modifier'\n    );\n\n    if (DEBUG && !eventName) {\n      throw new Error(\n        `You must pass a valid DOM event name as the first argument to the \\`on\\` modifier on ${selector}`\n      );\n    }\n\n    let arg1 = args.positional[1];\n    let userProvidedCallback = check(\n      arg1 ? valueForRef(arg1) : undefined,\n      CheckFunction,\n      (actual) => {\n        return `You must pass a function as the second argument to the \\`on\\` modifier; you passed ${\n          actual === null ? 'null' : typeof actual\n        }. While rendering:\\n\\n${args.positional[1]?.debugLabel ?? `{unlabeled value}`}`;\n      }\n    ) as EventListener;\n\n    if (DEBUG && typeof userProvidedCallback !== 'function') {\n      throw new Error(\n        `You must pass a function as the second argument to the \\`on\\` modifier; you passed ${","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@glimmer/runtime/lib/modifiers/on.ts#L61-L97","documentation":"Error \"You must pass a valid DOM event name as the first argument to the `on` modifier on ${selector}\" thrown in emberjs/ember.js.","triggerScenarios":"Thrown at packages/@glimmer/runtime/lib/modifiers/on.ts:79 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}