BigPizzaV3/CodexPlusPlus · error

{label} SHA-256 校验失败

Error message

{label} SHA-256 校验失败

What it means

Integrity guard in verify_sha256: the downloaded content's actual SHA-256 does not equal the expected hash from the manifest. label identifies the asset (theme or image). This fires on truncated downloads, corrupted files, or a manifest pointing at different content — install is aborted before anything is written.

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 f2074595a2)

Solutions

  1. Retry the download; a transient truncation may be the cause
  2. Refresh the manifest — the asset may have been updated with a new hash
  3. Report a persistent mismatch to the market maintainer
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_market.rs:389 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/441226c02a2983dc. Report an issue: GitHub.