denoland/deno · error · Error
Linter plugin has already been registered
Error message
Linter plugin ${plugin.name} has already been registered What it means
The linter keeps a per-instance set of installed plugin names (state.installedPlugins in cli/js/40_lint.js). Installing a second plugin with a name already in that set throws `Linter plugin <name> has already been registered`. Unlike the validation errors, this message has no specifier prefix — only the offending plugin name is included.
Solutions
- Deduplicate the `lint.plugins` list so each plugin module is listed once under one canonical specifier.
- If two genuinely different plugins collide, rename one of them to a unique lowercase-hyphen name.
- Search the plugin sources for `name:` exports to find which two files claim the same name (the error message names it).
Example fix
// deno.json before
{
"lint": {
"plugins": ["./rules/mod.js", "https://example.com/rules/mod.js"]
}
}
// after
{
"lint": {
"plugins": ["./rules/mod.js"]
}
} Defensive patterns
Strategy: validation
Validate before calling
// Before listing plugins, load them and deduplicate by name
const plugins = [await import("./a.js"), await import("./b.js")];
const seen = new Set();
for (const p of plugins) {
if (seen.has(p.default.name)) {
throw new Error(`Duplicate lint plugin name: ${p.default.name}`);
}
seen.add(p.default.name);
} Prevention
- Keep one canonical specifier per plugin in lint.plugins; do not list both a path and a URL for the same module.
- Give shared/monorepo plugins distinctive names to avoid collisions across teams.
- If the error appears, grep plugin sources for `name:` to find the two files claiming the name in the message.
When it happens
Trigger: The same plugin name installed twice in one linter run: the same module listed twice in `lint.plugins` under different specifiers (e.g. a URL and a local path that resolve to the same code), two different files exporting plugins with the same `name`, or a programmatic caller invoking installPlugins twice with the same list.
Common situations: Listing a plugin both by absolute path and relative path in config; a monorepo where two teams shipped plugins with a generic name like "lint-rules"; refactoring that left an old entry and a new entry pointing at the same plugin.
Related errors
- Destroy hook of " " errored
- Empty node
- Empty selector
- Expected 'of' keyword in ':nth-child' but got
- Expected token ' ', but got ' '.\n\n \n ^
AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20).
Data as JSON: /api/errors/e532b2d8236595a9.
Report an issue: GitHub.
Appendix: source
Thrown at cli/js/40_lint.js:507
throw new Error(
`${prefix}Linter plugin name must only contain lowercase letters (a-z) or hyphens (-).`,
);
}
if (plugin.name.startsWith("-") || plugin.name.endsWith("-")) {
throw new Error(
`${prefix}Linter plugin name must start and end with a lowercase letter.`,
);
}
if (plugin.name.includes("--")) {
throw new Error(
`${prefix}Linter plugin name must not have consequtive hyphens.`,
);
}
if (typeof plugin.rules !== "object") {
throw new Error(`${prefix}Linter plugin rules must be an object`);
}
if (state.installedPlugins.has(plugin.name)) {
throw new Error(`Linter plugin ${plugin.name} has already been registered`);
}
state.plugins.push(plugin);
state.installedPlugins.add(plugin.name);
return {
name: plugin.name,
ruleNames: Object.keys(plugin.rules),
};
}
/**
* @param {AstContext} ctx
* @param {number} idx
* @returns {FacadeNode | null}
*/
function getNode(ctx, idx) {
if (idx === AST_IDX_INVALID) return null;
const cached = ctx.nodes.get(idx);View on GitHub (pinned to 9ad36f7a2c)