videojs/video.js · error · Error

plugin "${name}" does not exist

Error message

plugin "${name}" does not exist

What it means

During player init, every key in options.plugins is expected to correspond to a registered plugin method on the player instance (videojs adds plugin methods to Player.prototype at registration time). If this[name] is not a function for any plugin key, that plugin was never registered, so its configured options would be silently ignored — video.js fails fast instead.

Source

Thrown at src/js/player.js:483

    this.changingSrc_ = false;
    this.playCallbacks_ = [];
    this.playTerminatedQueue_ = [];

    // the attribute overrides the option
    if (tag.hasAttribute('autoplay')) {
      this.autoplay(true);
    } else {
      // otherwise use the setter to validate and
      // set the correct value.
      this.autoplay(this.options_.autoplay);
    }

    // check plugins
    if (options.plugins) {
      Object.keys(options.plugins).forEach((name) => {
        if (typeof this[name] !== 'function') {
          throw new Error(`plugin "${name}" does not exist`);
        }
      });
    }

    /*
     * Store the internal state of scrubbing
     *
     * @private
     * @return {Boolean} True if the user is scrubbing
     */
    this.scrubbing_ = false;

    this.el_ = this.createEl();

    // Make this an evented object and use `el_` as its event bus.
    evented(this, {eventBusKey: 'el_'});

    // listen to document and player fullscreenchange handlers so we receive those events

View on GitHub (pinned to c3a7e0e6d2)

Solutions

  1. Register the plugin before creating the player: videojs.registerPlugin('myPlugin', myPlugin) (or rely on the plugin's self-registering side-effect import).
  2. Ensure the plugin script is loaded/executed before the videojs('vid', {...}) call.
  3. Verify spelling/case of the plugin name against the registered name.

Example fix

// before
videojs('vid', { plugins: { markers: {} } }); // markers plugin not loaded
// after
import 'videojs-markers'; // side-effect: registers plugin
videojs('vid', { plugins: { markers: {} } });
Defensive patterns

Strategy: validation

Validate before calling

function validatePluginsOption(player, options) {
  if (!options.plugins) return;
  Object.keys(options.plugins).forEach((name) => {
    if (typeof player[name] !== 'function') {
      throw new Error(`plugin '${name}' not registered before player init`);
    }
  });
}

Type guard

const pluginIsRegistered = (name) =>
  typeof videojs.Player.prototype[name] === 'function';

Prevention

When it happens

Trigger: Calling videojs('vid', {plugins: {myPlugin: {...}}}) when 'myPlugin' was never registered via videojs.registerPlugin('myPlugin', ...); typo in plugin name; plugin script loaded after the player call.

Common situations: Plugin <script> tag ordered after the player init code; plugin bundled separately and tree-shaken; rename of a plugin without updating config; SSR where plugins are not registered server-side.

Related errors


AI-assisted analysis of videojs/video.js@c3a7e0e6d2 (2026-08-13). Data as JSON: /api/errors/4d3d138e7c608688. Report an issue: GitHub.