videojs/video.js · error · Error
Cannot de-register base plugin.
Error message
Cannot de-register base plugin.
What it means
deregisterPlugin refuses to remove the base 'plugin' name (BASE_PLUGIN_NAME) because it is the abstract parent every advanced plugin extends; removing it would break subclass instantiation and the getPlugin('plugin') lookup. All other plugins can be de-registered freely. The check happens before any deletion.
Source
Thrown at src/js/plugin.js:388
}
}
return plugin;
}
/**
* De-register a Video.js plugin.
*
* @param {string} name
* The name of the plugin to be de-registered. Must be a string that
* matches an existing plugin.
*
* @throws {Error}
* If an attempt is made to de-register the base plugin.
*/
static deregisterPlugin(name) {
if (name === BASE_PLUGIN_NAME) {
throw new Error('Cannot de-register base plugin.');
}
if (pluginExists(name)) {
delete pluginStorage[name];
delete Player.prototype[name];
}
}
/**
* Gets an object containing multiple Video.js plugins.
*
* @param {Array} [names]
* If provided, should be an array of plugin names. Defaults to _all_
* plugin names.
*
* @return {Object|undefined}
* An object containing plugin(s) associated with their name(s) or
* `undefined` if no matching plugins exist).
*/View on GitHub (pinned to c3a7e0e6d2)
Solutions
- Skip the base name when de-registering: if (name !== 'plugin') videojs.deregisterPlugin(name).
- Filter getPlugins() output to exclude 'plugin' before bulk de-registration.
- Only de-register plugins you actually registered.
Example fix
// before Object.keys(videojs.getPlugins()).forEach(n => videojs.deregisterPlugin(n)); // throws on 'plugin' // after Object.keys(videojs.getPlugins()) .filter(n => n !== 'plugin') .forEach(n => videojs.deregisterPlugin(n));
Defensive patterns
Strategy: validation
Validate before calling
function safeDeregister(name) {
if (name === 'plugin') throw new Error('cannot de-register base plugin');
videojs.deregisterPlugin(name);
}
// bulk cleanup
Object.keys(videojs.getPlugins())
.filter((n) => n !== 'plugin')
.forEach((n) => videojs.deregisterPlugin(n)); Type guard
const isDeregisterable = (name) => typeof name === 'string' && name !== 'plugin';
Prevention
- Always exclude 'plugin' from bulk de-registration loops.
- Only de-register plugins you registered.
- Track your own registered names in test/HMR teardown.
When it happens
Trigger: Calling videojs.deregisterPlugin('plugin') explicitly; a generic cleanup loop that de-registers every name returned by getPlugins() including the base.
Common situations: HMR teardown loops; test cleanup that iterates all plugins; tooling that de-registers by name without filtering.
Related errors
- Can not register Player component after player has been crea
- plugin "${name}" does not exist
- Illegal plugin name, "${name}", must be a string, was ${type
- Illegal plugin name, "${name}", cannot share a name with an
- Illegal plugin for "${name}", must be a function, was ${type
AI-assisted analysis of videojs/video.js@c3a7e0e6d2 (2026-08-13).
Data as JSON: /api/errors/ee890eec046a84b1.
Report an issue: GitHub.