{"record":{"id":"ee2e36295d3db1b9","repo":"rust-lang/cargo","slug":"the-listed-checksum-of-has-changed-expected","errorCode":null,"errorMessage":"the listed checksum of `{}` has changed:\nexpected: {}\nactual:   {}\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","messagePattern":"the listed checksum of `(.+?)` has changed:\nexpected: (.+?)\nactual:   (.+?)\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","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sources/directory.rs","lineNumber":249,"sourceCode":"\n    fn fingerprint(&self, pkg: &Package) -> CargoResult<String> {\n        Ok(pkg.package_id().version().to_string())\n    }\n\n    fn verify(&self, id: PackageId) -> CargoResult<()> {\n        let packages = self.packages.borrow_mut();\n        let Some((pkg, cksum)) = packages.get(&id) else {\n            anyhow::bail!(\"failed to find entry for `{}` in directory source\", id);\n        };\n\n        for (file, cksum) in cksum.files.iter() {\n            let file = pkg.root().join(file);\n            let actual = Sha256::new()\n                .update_path(&file)\n                .with_context(|| format!(\"failed to calculate checksum of: {}\", file.display()))?\n                .finish_hex();\n            if &*actual != cksum {\n                anyhow::bail!(\n                    \"the listed checksum of `{}` has changed:\\n\\\n                     expected: {}\\n\\\n                     actual:   {}\\n\\\n                     \\n\\\n                     directory sources are not intended to be edited, if \\\n                     modifications are required then it is recommended \\\n                     that `[patch]` is used with a forked copy of the \\\n                     source\\\n                     \",\n                    file.display(),\n                    cksum,\n                    actual\n                );\n            }\n        }\n\n        Ok(())\n    }","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/rust-lang/cargo/blob/98a09e7e7d62850f14e5b6132101fc1edd19a16f/src/sources/directory.rs#L231-L267","documentation":"Error \"the listed checksum of `{}` has changed:\nexpected: {}\nactual:   {}\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\" thrown in rust-lang/cargo.","triggerScenarios":"Thrown at src/sources/directory.rs:246 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"98a09e7e7d62850f14e5b6132101fc1edd19a16f","analyzedAt":"2026-08-11T17:42:36.556Z","contentChangedAt":"2026-08-11T17:42:36.556Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}