GoogleChrome/lighthouse · error · Error

plugin name '${pluginName}' not allowed because it is the id

Error message

plugin name '${pluginName}' not allowed because it is the id of a category already found in config

What it means

Thrown by assertValidPluginName in validation.js. After confirming the prefix, Lighthouse checks the plugin name does not collide with an existing category id in the config (config.categories?.[pluginName]). A plugin becomes a category keyed by its name, so a duplicate id would overwrite an existing category. The collision is rejected.

Source

Thrown at core/config/validation.js:49

}

/**
 * Throws if pluginName is invalid or (somehow) collides with a category in the
 * config being added to.
 * @param {LH.Config} config
 * @param {string} pluginName
 */
function assertValidPluginName(config, pluginName) {
  const parts = pluginName.split('/');
  if (parts.length === 2) {
    pluginName = parts[1];
  }
  if (!pluginName.startsWith('lighthouse-plugin-')) {
    throw new Error(`plugin name '${pluginName}' does not start with 'lighthouse-plugin-'`);
  }

  if (config.categories?.[pluginName]) {
    throw new Error(`plugin name '${pluginName}' not allowed because it is the id of a category already found in config`); // eslint-disable-line max-len
  }
}

/**
 * Throws an error if the provided object does not implement the required gatherer interface.
 * @param {LH.Config.AnyArtifactDefn} artifactDefn
 */
function assertValidArtifact(artifactDefn) {
  const gatherer = artifactDefn.gatherer.instance;

  if (typeof gatherer.meta !== 'object') {
    throw new Error(`Gatherer for ${artifactDefn.id} did not provide a meta object.`);
  }

  if (gatherer.meta.supportedModes.length === 0) {
    throw new Error(`Gatherer for ${artifactDefn.id} did not support any gather modes.`);
  }

View on GitHub (pinned to 9515cd4e58)

Solutions

  1. Remove the duplicate manually-defined category that shares the plugin's id.
  2. Rename the plugin so its id is unique among categories.
  3. Ensure each plugin is listed only once in config.plugins.

Example fix

// before
categories: {'lighthouse-plugin-foo': {...}},
plugins: ['lighthouse-plugin-foo']
// after
categories: {/* remove the conflicting manual category */},
plugins: ['lighthouse-plugin-foo']
Defensive patterns

Strategy: validation

Validate before calling

for (const name of config.plugins) {
  const base = name.split('/').pop();
  if (config.categories && config.categories[base]) {
    throw new Error(`Plugin '${name}' collides with existing category '${base}'`);
  }
}

Type guard

function pluginNameIsUnique(name, categories) {
  const base = name.split('/').pop();
  return !(categories && categories[base]);
}

Try / catch

try { await lighthouse(url, flags, config); }
catch (e) { if (/id of a category already found/.test(e.message)) console.error('Remove duplicate category or rename plugin'); throw e; }

Prevention

When it happens

Trigger: Config already has categories.lighthouse-plugin-foo (or a manually added category with that id) and you add plugin 'lighthouse-plugin-foo'. validation.js:49 throws because the name already maps to a category.

Common situations: Loading the same plugin twice. A custom config that manually defines a category whose id matches a plugin name. Plugin id clash between two plugins.

Related errors


AI-assisted analysis of GoogleChrome/lighthouse@9515cd4e58 (2026-08-13). Data as JSON: /api/errors/fe1b4a260ca78ab1. Report an issue: GitHub.