{"id":"e5b5801936036f2b","repo":"rust-lang/cargo","slug":"failed-to-find-rmeta","errorCode":null,"errorMessage":"failed to find rmeta","messagePattern":"failed to find rmeta","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/compiler/fingerprint/mod.rs","lineNumber":1310,"sourceCode":"                | FsStatus::StaleDependency { .. }\n                | FsStatus::StaleDepFingerprint { .. } => {\n                    self.fs_status = FsStatus::StaleDepFingerprint {\n                        unit: dep.fingerprint.index,\n                    };\n                    return Ok(());\n                }\n            };\n\n            // If our dependency edge only requires the rmeta file to be present\n            // then we only need to look at that one output file, otherwise we\n            // need to consider all output files to see if we're out of date.\n            let (dep_path, dep_mtime) = if dep.only_requires_rmeta {\n                dep_mtimes\n                    .iter()\n                    .find(|(path, _mtime)| {\n                        path.extension().and_then(|s| s.to_str()) == Some(\"rmeta\")\n                    })\n                    .expect(\"failed to find rmeta\")\n            } else {\n                match dep_mtimes.iter().max_by_key(|kv| kv.1) {\n                    Some(dep_mtime) => dep_mtime,\n                    // If our dependencies is up to date and has no filesystem\n                    // interactions, then we can move on to the next dependency.\n                    None => continue,\n                }\n            };\n            debug!(\n                \"max dep mtime for {:?} is {:?} {}\",\n                pkg_root, dep_path, dep_mtime\n            );\n\n            // If the dependency is newer than our own output then it was\n            // recompiled previously. We transitively become stale ourselves in\n            // that case, so bail out.\n            //\n            // Note that this comparison should probably be `>=`, not `>`, but","sourceCodeStart":1292,"sourceCodeEnd":1328,"githubUrl":"https://github.com/rust-lang/cargo/blob/0e07a155371a6ce88ae53a2c00df940280c09a67/src/compiler/fingerprint/mod.rs#L1292-L1328","documentation":"While checking staleness, the fingerprint code selects the `.rmeta` output from a dependency's mtimes via `.find(...).expect(\"failed to find rmeta\")` when `dep.only_requires_rmeta` is true. The dependency's outputs are expected to contain an `.rmeta` file; the panic means none of the recorded output paths has the `rmeta` extension.","triggerScenarios":"A dependency edge marked `only_requires_rmeta` whose compiled outputs were stripped of the `.rmeta` (e.g. it was built with a mode that emits only an rlib, or the file was deleted between Cargo recording it and the fingerprint check); pipelined compilation where the rmeta was never produced (rustc failed) but the unit was marked fresh.","commonSituations":"`cargo clean`/file deletion racing with a build; switching rustc versions without cleaning (rmeta emission rules changed); disk-full or antivirus quarantine removing `.rmeta` files from `target/`.","solutions":["`cargo clean` and rebuild — missing `.rmeta` is almost always a stale/corrupt `target/`.","Ensure no external process deletes files under `target/` (antivirus, backup tools, IDE cleanup).","Free disk space if `target/` ran out of inodes/space mid-build."],"exampleFix":"// before\nlet (dep_path, dep_mtime) = if dep.only_requires_rmeta {\n    dep_mtimes\n        .iter()\n        .find(|(path, _mtime)| path.extension().and_then(|s| s.to_str()) == Some(\"rmeta\"))\n        .expect(\"failed to find rmeta\")\n};\n// after\nlet (dep_path, dep_mtime) = if dep.only_requires_rmeta {\n    dep_mtimes\n        .iter()\n        .find(|(path, _mtime)| path.extension().and_then(|s| s.to_str()) == Some(\"rmeta\"))\n        .ok_or_else(|| anyhow::anyhow!(\"dependency marked only_requires_rmeta has no .rmeta output\"))?\n};","handlingStrategy":"validation","validationCode":"// Confirm the target dir still contains .rmeta files before incremental rebuilds\nfn has_rmeta(target_deps: &std::path::Path) -> bool {\n    walkdir::WalkDir::new(target_deps).into_iter().filter_map(Result::ok)\n        .any(|e| e.path().extension().and_then(|s| s.to_str()) == Some(\"rmeta\"))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["`cargo clean` whenever you switch rustc versions.","Exclude `target/` from antivirus/backup/IDE cleanup.","Ensure adequate free disk space and inodes."],"tags":["cargo","fingerprint","rmeta","pipelined","internal-invariant"],"analyzedSha":"0e07a155371a6ce88ae53a2c00df940280c09a67","analyzedAt":"2026-08-06T01:46:58.334Z","schemaVersion":2}