{"record":{"id":"c8c7bf1f70559883","repo":"rustfs/rustfs","slug":"sha256-mismatch","errorCode":null,"errorMessage":"SHA256 mismatch","messagePattern":"SHA256 mismatch","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/rio/src/hash_reader.rs","lineNumber":563,"sourceCode":"                        error!(\"SHA256 hasher write error, error={:?}\", e);\n                        return Poll::Ready(Err(std::io::Error::other(e)));\n                    }\n\n                    // Update content hasher\n                    if let Some(hasher) = this.content_hasher\n                        && let Err(e) = hasher.write_all(data)\n                    {\n                        return Poll::Ready(Err(std::io::Error::other(e)));\n                    }\n                }\n\n                if filled == 0 && !*this.checksum_on_finish {\n                    // check SHA256\n                    if let (Some(hasher), Some(expected_sha256)) = (this.content_sha256_hasher, this.content_sha256) {\n                        let sha256 = hex_simd::encode_to_string(hasher.finalize(), hex_simd::AsciiCase::Lower);\n                        if sha256 != *expected_sha256 {\n                            error!(\"SHA256 mismatch, expected={:?}, actual={:?}\", expected_sha256, sha256);\n                            return Poll::Ready(Err(std::io::Error::new(std::io::ErrorKind::InvalidData, \"SHA256 mismatch\")));\n                        }\n                    }\n\n                    // check content hasher\n                    if let (Some(hasher), Some(expected_content_hash)) = (this.content_hasher, this.content_hash) {\n                        if expected_content_hash.checksum_type.trailing()\n                            && let Some(trailer) = this.trailer_s3s.as_ref()\n                            && let Some(Some(checksum_str)) = trailer.read(|headers| {\n                                expected_content_hash\n                                    .checksum_type\n                                    .key()\n                                    .and_then(|key| headers.get(key).and_then(|value| value.to_str().ok().map(|s| s.to_string())))\n                            })\n                        {\n                            expected_content_hash.encoded = checksum_str;\n                            expected_content_hash.raw = general_purpose::STANDARD\n                                .decode(&expected_content_hash.encoded)\n                                .map_err(|_| std::io::Error::other(\"Invalid base64 checksum\"))?;","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/rustfs/rustfs/blob/35af688cd9d41b4346fbe27dcf7250ba72046c1f/crates/rio/src/hash_reader.rs#L545-L581","documentation":"Fires when the streamed body finishes and the SHA256 computed by the content hasher differs from the expected value, or the hasher errors at finish. Guards integrity of chunked/trailing-checksum uploads at read completion.","triggerScenarios":"Thrown at crates/rio/src/hash_reader.rs:563 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the upload; transit corruption is often transient","Fix client body mutation after signing","Verify no middleware rewrites the payload"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35af688cd9d41b4346fbe27dcf7250ba72046c1f","analyzedAt":"2026-08-20T21:57:04.799Z","contentChangedAt":"2026-08-20T21:57:04.799Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}