rust-lang/cargo · error · anyhow::Error
`lints.{tool}.{name}` is not a valid lint name
Error message
`lints.{tool}.{name}` is not a valid lint name What it means
Thrown during lint-table validation at src/workspace/parser/mod.rs:2735 — the catch-all for a lint name that contains `::` but matches neither of the recoverable cases (prefix != tool, and not a supported-tool re-home). Cargo cannot map the qualified name to any known lint group, so it rejects it as simply "not a valid lint name".
Source
Thrown at src/workspace/parser/mod.rs:2735
}
if let Some(existing) = seen_normalized.get(&normalized) {
warnings.push(format!(
"duplicate lint `{existing}` in `[lints.{tool}]`, \
conflicts with `{name}` and will not work in a future edition"
));
}
seen_normalized.insert(normalized.clone(), name.to_string());
if let Some((prefix, suffix)) = name.split_once("::") {
if tool == prefix {
anyhow::bail!(
"`lints.{tool}.{name}` is not valid lint name; try `lints.{prefix}.{suffix}`"
)
} else if tool == "rust" && supported.contains(&prefix) {
anyhow::bail!(
"`lints.{tool}.{name}` is not valid lint name; try `lints.{prefix}.{suffix}`"
)
} else {
anyhow::bail!("`lints.{tool}.{name}` is not a valid lint name")
}
} else if let Some(config) = config.config() {
for config_name in config.keys() {
// manually report unused manifest key warning since we collect all the "extra"
// keys and values inside the config table
let expected = EXPECTED_LINT_CONFIG.contains(&(tool, name, config_name));
if !expected {
let message =
format!("unused manifest key: `lints.{tool}.{name}.{config_name}`");
warnings.push(message);
}
}
}
}
}
Ok(())
}View on GitHub (pinned to 0e07a15537)
Solutions
- Use the bare, real lint name for the tool: `[lints.rust] bar = "warn"`.
- Confirm the lint exists via `rustc -W help` / clippy docs and which tool table it belongs to.
- Drop any unsupported `::` qualifier.
Example fix
# before [lints.rust] foo::bar = "warn" # after [lints.rust] bar = "warn"
Defensive patterns
Strategy: validation
Validate before calling
for (name, _) in lints_for_tool {
if name.contains("::") {
return Err(format!("{name} is not a valid lint name for [lints.{tool}]"));
}
} Prevention
- Verify lint names against `rustc -W help`/clippy docs.
- Avoid inventing `::` group qualifiers; use bare names.
When it happens
Trigger: A lint key like `[lints.rust] foo::bar = "warn"` where `foo` is neither the tool nor a supported tool (e.g. an arbitrary group or typo).
Common situations: Typos in lint names; using clippy-style group names under the wrong tool; inventing qualified names that don't exist.
Related errors
- `lints.{tool}.{name}` is not valid lint name; try `lints.{pr
- the crate `{}` depends on crate `{}` multiple times with dif
- Use of `default_features` in `{key}` is unsupported, please
- cannot override `workspace.lints` in `lints`, either remove
- `{old_path}` is unsupported as of the 2024 edition; instead
AI-assisted analysis of rust-lang/cargo@0e07a15537 (2026-08-06).
Data as JSON: /data/errors/45ee40860e16f1ee.json.
Report an issue: GitHub.