{"record":{"id":"9fdde5ba7834b979","repo":"videojs/video.js","slug":"invalid-event-type-for-objname-this-trigger-m","errorCode":null,"errorMessage":"Invalid event type for ${objName(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.","messagePattern":"Invalid event type for (.+?)#trigger; must be a non-empty string or object with a type key that has a non-empty value\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/js/mixins/evented.js","lineNumber":452,"sourceCode":"  /**\n   * Fire an event on this evented object, causing its listeners to be called.\n   *\n   * @param   {string|Object} event\n   *          An event type or an object with a type property.\n   *\n   * @param   {Object} [hash]\n   *          An additional object to pass along to listeners.\n   *\n   * @return {boolean}\n   *          Whether or not the default behavior was prevented.\n   */\n  trigger(event, hash) {\n    validateTarget(this.eventBusEl_, this, 'trigger');\n\n    const type = event && typeof event !== 'string' ? event.type : event;\n\n    if (!isValidEventType(type)) {\n      throw new Error(`Invalid event type for ${objName(this)}#trigger; ` +\n        'must be a non-empty string or object with a type key that has a non-empty value.');\n    }\n    return Events.trigger(this.eventBusEl_, event, hash);\n  }\n};\n\n/**\n * Applies {@link module:evented~EventedMixin|EventedMixin} to a target object.\n *\n * @param  {Object} target\n *         The object to which to add event methods.\n *\n * @param  {Object} [options={}]\n *         Options for customizing the mixin behavior.\n *\n * @param  {string} [options.eventBusKey]\n *         By default, adds a `eventBusEl_` DOM element to the target object,\n *         which is used as an event bus. If the target object already has a","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/videojs/video.js/blob/c3a7e0e6d20cf5400c9afbee29965fe4dff393c2/src/js/mixins/evented.js#L434-L470","documentation":"trigger() accepts either a non-empty string event name or an event object whose type property is a non-empty string. Any other shape (empty string, null, number, object without type) cannot be dispatched and is rejected. This mirrors validateEventType but is specialized to trigger's broader input contract.","triggerScenarios":"Calling obj.trigger(''), obj.trigger(null), obj.trigger({}), obj.trigger({type: ''}), or obj.trigger(42).","commonSituations":"Triggering events from a variable that was not populated; passing an Error object expecting it to be auto-typed; refactoring that drops the type key.","solutions":["Pass a literal event name: obj.trigger('customevent').","Pass a full event object: obj.trigger({type: 'customevent', data: payload}).","Default the type before triggering: const type = rawType || 'change'; obj.trigger({type});"],"exampleFix":"// before\nthis.trigger(this.eventName); // eventName is undefined\n// after\nthis.trigger(this.eventName || 'statechanged');","handlingStrategy":"validation","validationCode":"function safeTrigger(obj, event) {\n  const type = event && typeof event !== 'string' ? event.type : event;\n  if (typeof type !== 'string' || type.length === 0) {\n    throw new TypeError('trigger needs a non-empty string or {type}');\n  }\n  return obj.trigger(event);\n}","typeGuard":"const isTriggerable = (e) =>\n  (typeof e === 'string' && e.length > 0) ||\n  (e && typeof e === 'object' && typeof e.type === 'string' && e.type.length > 0);","tryCatchPattern":null,"preventionTips":["Always populate the event name before triggering.","Pass {type: 'x', ...payload} for structured events.","Avoid passing Error objects directly without a type."],"tags":["events","evented","validation"],"backgroundTag":null,"analyzedSha":"c3a7e0e6d20cf5400c9afbee29965fe4dff393c2","analyzedAt":"2026-08-13T04:20:15.471Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}