rust-lang/rust-clippy · error
{msg}: {e}
Error message
{msg}: {e} What it means
Emitted when canonicalizing the directory Clippy searches for its config file fails. The {msg} placeholder carries a generic sentinel naming the input at fault: the directory given by CLIPPY_CONF_DIR, CARGO_MANIFEST_DIR, or the current directory '.' if neither env var is set. load_conf_file canonicalizes that path before scanning for .clippy.toml/clippy.toml; an I/O error here means the configured search directory does not exist, is not readable, or a path component is invalid, so config discovery aborts and returns None.
Solutions
- Verify the directory named in the error exists and is readable by the Clippy process
- Fix or unset CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR so they point at a valid directory
- Check for typos, removed mount points, or permission restrictions on path components
- Fall back to running Clippy from the workspace root so the '.' default resolves
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at clippy_config/src/conf.rs:883 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rust-lang/rust-clippy@13aece1138 (2026-09-07).
Data as JSON: /api/errors/8361694e33dddaa3.
Report an issue: GitHub.
Appendix: source
Thrown at clippy_config/src/conf.rs:883
const CONFIG_FILE_NAMES: [&str; 2] = [".clippy.toml", "clippy.toml"];
// Start looking for a config file in CLIPPY_CONF_DIR, or failing that, CARGO_MANIFEST_DIR.
// If neither of those exist, use ".". (Update documentation if this priority changes)
const CONFIG_VARS: [(&str, &str); 2] = [
("CLIPPY_CONF_DIR", "failed to read `CLIPPY_CONF_DIR` as a directory"),
(
"CARGO_MANIFEST_DIR",
"failed to read `CARGO_MANIFEST_DIR` as a directory",
),
];
let (current, msg) = CONFIG_VARS
.into_iter()
.find_map(|(var, msg)| env::var_os(var).map(|p| (PathBuf::from(p), msg)))
.unwrap_or_else(|| (PathBuf::from("."), "failed to get the current directory"));
let mut current = match current.canonicalize() {
Ok(x) => x,
Err(e) => {
sess.dcx().err(format!("{msg}: {e}"));
return None;
},
};
let mut loaded_config: Option<(PathBuf, Arc<SourceFile>)> = None;
loop {
for config_file_name in CONFIG_FILE_NAMES {
if let Ok(config_path) = current.join(config_file_name).canonicalize() {
if let Some((loaded_path, _)) = &loaded_config {
if fs::metadata(loaded_path).is_ok_and(|x| x.is_file()) {
// Warn if `.clippy.toml` and `clippy.toml` exist
sess.dcx().warn(format!(
"using config file `{}`, `{}` will be ignored",
loaded_path.display(),
config_path.display(),
));
}
} else {View on GitHub (pinned to 13aece1138)