liabru/matter-js · warning
Plugin.register: does not implement all required fields.
Error message
Plugin.register: does not implement all required fields.
What it means
Plugin.register validates the object with Plugin.isPlugin, which requires name, version, and install fields (install may be use/defaults variant). If the object lacks these required fields, a warning is emitted; the plugin is still registered (unless it also fails other checks), but Plugin.use/dependency resolution may misbehave. This is a plugin-structure contract violation.
Source
Thrown at src/core/Plugin.js:25
var Plugin = {};
module.exports = Plugin;
var Common = require('./Common');
(function() {
Plugin._registry = {};
/**
* Registers a plugin object so it can be resolved later by name.
* @method register
* @param plugin {} The plugin to register.
* @return {object} The plugin.
*/
Plugin.register = function(plugin) {
if (!Plugin.isPlugin(plugin)) {
Common.warn('Plugin.register:', Plugin.toString(plugin), 'does not implement all required fields.');
}
if (plugin.name in Plugin._registry) {
var registered = Plugin._registry[plugin.name],
pluginVersion = Plugin.versionParse(plugin.version).number,
registeredVersion = Plugin.versionParse(registered.version).number;
if (pluginVersion > registeredVersion) {
Common.warn('Plugin.register:', Plugin.toString(registered), 'was upgraded to', Plugin.toString(plugin));
Plugin._registry[plugin.name] = plugin;
} else if (pluginVersion < registeredVersion) {
Common.warn('Plugin.register:', Plugin.toString(registered), 'can not be downgraded to', Plugin.toString(plugin));
} else if (plugin !== registered) {
Common.warn('Plugin.register:', Plugin.toString(plugin), 'is already registered to different plugin object');
}
} else {
Plugin._registry[plugin.name] = plugin;
}View on GitHub (pinned to acb99b6f87)
Solutions
- Ensure the plugin object has name (string), version (semver string), and install (function).
- Check what you're passing: Plugin.toString(plugin) is included in the warning and shows the offending object.
- Use Plugin.isPlugin(candidate) yourself before registering to validate.
- If using the extended form, provide use and defaults instead of install per the plugin spec.
Example fix
// before
Plugin.register({ name: 'my-plugin' }); // missing version & install
// after
Plugin.register({
name: 'my-plugin',
version: '0.1.0',
install: function (base) { /* extend base */ }
}); Defensive patterns
Strategy: validation
Validate before calling
if (!Matter.Plugin.isPlugin(candidate)) {
throw new TypeError('Plugin must define name, version and install: ' + JSON.stringify(candidate));
}
Matter.Plugin.register(candidate); Type guard
function isWellFormedPlugin(p) {
return typeof p === 'object' && p !== null &&
typeof p.name === 'string' && p.name.length > 0 &&
typeof p.version === 'string' &&
(typeof p.install === 'function' || typeof p.use === 'function');
} Prevention
- Validate with Matter.Plugin.isPlugin before registering
- Always include name, version (semver) and install on plugin objects
- Check module.exports points at the plugin object, not a wrapper
- Read the full warning: Plugin.toString(plugin) identifies the offending object
When it happens
Trigger: Plugin.register({}) or passing an object missing name/version/install — e.g. registering a plain function, a mistyped module export, or a plugin with version omitted.
Common situations: Typo in plugin definition (missing install function), exporting the wrong object, hand-rolled plugins without the required metadata, bundler tree-shaking dropping fields.
Related errors
- Plugin.register: was upgraded to
- Plugin.register: can not be downgraded to
- Plugin.register: is already registered to different plugin o
- Plugin.use: does not specify any dependencies to install.
- Plugin.use: is for but installed on .
AI-assisted analysis of liabru/matter-js@acb99b6f87 (2026-09-02).
Data as JSON: /api/errors/9ced652b68ce2ca7.
Report an issue: GitHub.