rust-lang/cargo · error
the listed checksum of
Error message
the listed checksum of `{}` has changed:
expected: {}
actual: {}
directory sources are not intended to be edited, if modifications are required then it is recommended that `[patch]` is used with a forked copy of the source What it means
Error "the listed checksum of `{}` has changed: expected: {} actual: {} directory sources are not intended to be edited, if modifications are required then it is recommended that `[patch]` is used with a forked copy of the source" thrown in rust-lang/cargo.
When it happens
Trigger: Thrown at src/sources/directory.rs:246 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rust-lang/cargo@98a09e7e7d (2026-08-11).
Data as JSON: /api/errors/ee2e36295d3db1b9.
Report an issue: GitHub.
Appendix: source
Thrown at src/sources/directory.rs:249
fn fingerprint(&self, pkg: &Package) -> CargoResult<String> {
Ok(pkg.package_id().version().to_string())
}
fn verify(&self, id: PackageId) -> CargoResult<()> {
let packages = self.packages.borrow_mut();
let Some((pkg, cksum)) = packages.get(&id) else {
anyhow::bail!("failed to find entry for `{}` in directory source", id);
};
for (file, cksum) in cksum.files.iter() {
let file = pkg.root().join(file);
let actual = Sha256::new()
.update_path(&file)
.with_context(|| format!("failed to calculate checksum of: {}", file.display()))?
.finish_hex();
if &*actual != cksum {
anyhow::bail!(
"the listed checksum of `{}` has changed:\n\
expected: {}\n\
actual: {}\n\
\n\
directory sources are not intended to be edited, if \
modifications are required then it is recommended \
that `[patch]` is used with a forked copy of the \
source\
",
file.display(),
cksum,
actual
);
}
}
Ok(())
}View on GitHub (pinned to 98a09e7e7d)