{"record":{"id":"60f3c1a9268f694b","repo":"liabru/matter-js","slug":"plugin-use-does-not-specify-an-install-function","errorCode":null,"errorMessage":"Plugin.use: does not specify an install function.","messagePattern":"Plugin\\.use: does not specify an install function\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/core/Plugin.js","lineNumber":160,"sourceCode":"\n            if (!plugin) {\n                status.push('❌ ' + sortedDependencies[i]);\n                continue;\n            }\n\n            if (Plugin.isUsed(module, plugin.name)) {\n                continue;\n            }\n\n            if (!Plugin.isFor(plugin, module)) {\n                Common.warn('Plugin.use:', Plugin.toString(plugin), 'is for', plugin.for, 'but installed on', Plugin.toString(module) + '.');\n                plugin._warned = true;\n            }\n\n            if (plugin.install) {\n                plugin.install(module);\n            } else {\n                Common.warn('Plugin.use:', Plugin.toString(plugin), 'does not specify an install function.');\n                plugin._warned = true;\n            }\n\n            if (plugin._warned) {\n                status.push('🔶 ' + Plugin.toString(plugin));\n                delete plugin._warned;\n            } else {\n                status.push('✅ ' + Plugin.toString(plugin));\n            }\n\n            module.used.push(plugin.name);\n        }\n\n        if (status.length > 0) {\n            Common.info(status.join('  '));\n        }\n    };\n","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/liabru/matter-js/blob/acb99b6f8784c809b940f1d2cf745427e088e088/src/core/Plugin.js#L142-L178","documentation":"Matter.Plugin.use registers a plugin by calling its install function. When a plugin object passed to Plugin.use (directly or via plugin list in Matter.use) has no install function, the library logs this warning and skips installation. The plugin still appears in warnings as '🔶' but is not initialized.","triggerScenarios":"Calling Matter.use(plugin) or Matter.Plugin.use(module, plugin) where plugin is an object without an install function property, or plugin is not registered via Plugin.register (which would return a valid plugin object).","commonSituations":"Hand-written plugin objects that only define a name/version but no install(module) method; passing a plugin constructor (class/function) instead of its registered instance; typos like 'instal' or install defined on the prototype of an unregistered function; loading a plugin module that exports metadata but no install.","solutions":["Add an install function to the plugin object: plugin.install = function(module) { ... } before calling Matter.use.","Register the plugin function/class via Plugin.register(MyPlugin) and use the returned plugin object (register attaches install).","Verify you are passing the plugin object, not the plugin namespace or factory, into Matter.use."],"exampleFix":"// before\nMatter.use({ name: 'my-plugin', version: '0.1.0' });\n// after\nMatter.use({\n  name: 'my-plugin',\n  version: '0.1.0',\n  install: function(matter) { /* extend matter here */ }\n});","handlingStrategy":"validation","validationCode":"if (typeof plugin !== 'object' || typeof plugin.install !== 'function') {\n  throw new TypeError('Plugin must define an install function before Matter.use(plugin)');\n}","typeGuard":"function isInstallablePlugin(p) {\n  return p !== null && typeof p === 'object' && typeof p.install === 'function';\n}","tryCatchPattern":null,"preventionTips":["Always define install(module) on every plugin object you pass to Matter.use.","Use Plugin.register(pluginFunction) and consume its return value instead of raw metadata objects.","Unit-test plugin registration in a headless setup to catch missing install early."],"tags":["plugin","api-misuse"],"backgroundTag":"plugin-missing-install-function","analyzedSha":"acb99b6f8784c809b940f1d2cf745427e088e088","analyzedAt":"2026-09-02T21:29:27.057Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}