{"record":{"id":"11ff046ee6f72f9c","repo":"videojs/video.js","slug":"illegal-plugin-name-name-cannot-share-a-nam","errorCode":null,"errorMessage":"Illegal plugin name, \"${name}\", cannot share a name with an existing player method!","messagePattern":"Illegal plugin name, \"(.+?)\", cannot share a name with an existing player method!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/js/plugin.js","lineNumber":354,"sourceCode":"   *          must not match an existing plugin or a method on the `Player`\n   *          prototype.\n   *\n   * @param   {typeof Plugin|Function} plugin\n   *          A sub-class of `Plugin` or a function for basic plugins.\n   *\n   * @return {typeof Plugin|Function}\n   *          For advanced plugins, a factory function for that plugin. For\n   *          basic plugins, a wrapper function that initializes the plugin.\n   */\n  static registerPlugin(name, plugin) {\n    if (typeof name !== 'string') {\n      throw new Error(`Illegal plugin name, \"${name}\", must be a string, was ${typeof name}.`);\n    }\n\n    if (pluginExists(name)) {\n      log.warn(`A plugin named \"${name}\" already exists. You may want to avoid re-registering plugins!`);\n    } else if (Player.prototype.hasOwnProperty(name)) {\n      throw new Error(`Illegal plugin name, \"${name}\", cannot share a name with an existing player method!`);\n    }\n\n    if (typeof plugin !== 'function') {\n      throw new Error(`Illegal plugin for \"${name}\", must be a function, was ${typeof plugin}.`);\n    }\n\n    pluginStorage[name] = plugin;\n\n    // Add a player prototype method for all sub-classed plugins (but not for\n    // the base Plugin class).\n    if (name !== BASE_PLUGIN_NAME) {\n      if (Plugin.isBasic(plugin)) {\n        Player.prototype[name] = createBasicPlugin(name, plugin);\n      } else {\n        Player.prototype[name] = createPluginFactory(name, plugin);\n      }\n    }\n","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/videojs/video.js/blob/c3a7e0e6d20cf5400c9afbee29965fe4dff393c2/src/js/plugin.js#L336-L372","documentation":"registerPlugin adds the plugin as a method on Player.prototype, so its name must not collide with an existing Player.prototype own property. A collision would shadow a core player method (e.g. 'play', 'src') and silently break playback, so registration refuses. Note: a duplicate plugin name only warns; this throw is specifically for Player method collisions.","triggerScenarios":"Calling videojs.registerPlugin('play', fn), registerPlugin('src', fn), or any name matching an own property on Player.prototype (src, load, pause, currentSrc, etc.).","commonSituations":"Generic plugin names like 'play', 'load', 'volume', 'src'; auto-generating plugin names from feature data without checking against Player API; renaming a plugin to a reserved name.","solutions":["Choose a name that does not match a Player.prototype method (e.g. 'myPlay' instead of 'play').","Check before registering: if (videojs.Player.prototype.hasOwnProperty(name)) throw.","Namespace plugin names with a prefix to avoid collisions."],"exampleFix":"// before\nvideojs.registerPlugin('src', myPlugin); // collides\n// after\nvideojs.registerPlugin('mySrc', myPlugin);","handlingStrategy":"validation","validationCode":"function safeRegisterPlugin(name, plugin) {\n  if (videojs.Player.prototype.hasOwnProperty(name)) {\n    throw new Error(`'${name}' collides with a Player method`);\n  }\n  return videojs.registerPlugin(name, plugin);\n}","typeGuard":"const collidesWithPlayerMethod = (name) =>\n  videojs.Player.prototype.hasOwnProperty(name);","tryCatchPattern":null,"preventionTips":["Namespace plugin names (e.g. 'myPluginSrc') to avoid collisions.","Cross-check new names against the Player API.","Avoid generic verbs: play, load, src, volume."],"tags":["plugin","registry","naming","player"],"backgroundTag":null,"analyzedSha":"c3a7e0e6d20cf5400c9afbee29965fe4dff393c2","analyzedAt":"2026-08-13T04:20:15.471Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}