BigPizzaV3/CodexPlusPlus · error
SHA-256 校验失败
Error message
{label} SHA-256 校验失败 What it means
verify_sha256 first validates the expected hash format via validate_sha256, then hashes the actual bytes with SHA-256 and compares. This error means the downloaded/installed content does not match the declared SHA-256 digest for the given label (e.g. package or image). It guards theme-market installs against corrupted or tampered downloads.
Solutions
- Re-download the theme asset and retry — the download may have been corrupted
- Recompute the correct hash (`sha256sum`) and update the market manifest to match the current asset
- Verify the asset URL points at the exact version the manifest describes (pin versions)
- If intentional tampering is suspected, reject the theme and obtain it from a trusted source
Example fix
// before (manifest hash from old asset) "sha256": "1111..." // after (hash of current asset) "sha256": "<sha256sum current-asset output>"
Defensive patterns
Strategy: retry
Validate before calling
let actual = Sha256::digest(&bytes);
let expected: [u8; 32] = hex::decode(manifest.sha256).map_err(|_| BadHash)?.try_into()?;
if actual != expected { return Err(ChecksumMismatch); } Try / catch
match install_market_theme_from_base(&url, &manifest).await {
Err(e) if e.to_string().ends_with("SHA-256 校验失败") => {
warn!("checksum mismatch, re-downloading");
retry_download_with_backoff(2)?;
}
Err(e) => return Err(e),
Ok(installed) => installed,
} Prevention
- Pin asset versions so manifest hashes always match served content
- Recompute and publish hashes whenever an asset changes
- Verify downloads on the server side before publishing the manifest
When it happens
Trigger: Calling install_market_theme_from_base where the SHA-256 digest of the fetched bytes differs from the `expected` value in the theme manifest — e.g. the base URL served different content, the file was re-uploaded without updating the manifest, or a proxy/CDN modified the payload.
Common situations: Theme author updated the asset but not the manifest hash, partial/corrupted download, CDN serving cached old version, MITM or tampering attempt.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- DreamSkin 主题包 SHA-256 与审核元数据不一致
- rollout changed before rollback
- Runtime changed outside Codex++
- 主题市场包含无效 SHA-256
- Unsupported native runtime component
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/441226c02a2983dc.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_market.rs:389
})
}
fn validate_sha256(value: &str) -> anyhow::Result<()> {
if value.len() != 64
|| !value
.bytes()
.all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))
{
bail!("主题市场包含无效 SHA-256");
}
Ok(())
}
fn verify_sha256(bytes: &[u8], expected: &str, label: &str) -> anyhow::Result<()> {
validate_sha256(expected)?;
let actual = format!("{:x}", Sha256::digest(bytes));
if actual != expected {
bail!("{label} SHA-256 校验失败");
}
Ok(())
}
fn detect_image_extension(bytes: &[u8]) -> Option<&'static str> {
if bytes.starts_with(b"\x89PNG\r\n\x1a\n") {
Some("png")
} else if bytes.starts_with(&[0xff, 0xd8, 0xff]) {
Some("jpg")
} else if bytes.starts_with(b"GIF87a") || bytes.starts_with(b"GIF89a") {
Some("gif")
} else if bytes.starts_with(b"BM") {
Some("bmp")
} else if bytes.len() >= 12 && &bytes[..4] == b"RIFF" && &bytes[8..12] == b"WEBP" {
Some("webp")
} else {
None
}View on GitHub (pinned to b1ed92e5e4)