BigPizzaV3/CodexPlusPlus · error

DreamSkin 主题包实际大小与审核元数据不一致

Error message

DreamSkin 主题包实际大小与审核元数据不一致

What it means

After downloading the theme ZIP, install_community_theme compares the downloaded byte length against metadata.package_bytes recorded at review time. A mismatch means the package served by the download endpoint differs from the reviewed artifact (truncated download, replaced file, or metadata drift), so the install is aborted before any integrity-sensitive processing.

Solutions

  1. Retry the install — transient truncation is the most common cause.
  2. Check network/proxy: verify the download URL returns a binary ZIP (Content-Type application/zip), not an HTML error page.
  3. Re-fetch metadata and compare sizes; if metadata.package_bytes itself changed, the theme was re-uploaded server-side.
  4. Report to the theme maintainer/community operators if the server package persistently mismatches review metadata.

Example fix

// before: blind install
install_community_theme(&state_dir, version_id).await?;
// after: pre-check on stable network
// verify connectivity, then retry on size mismatch:
match install_community_theme(&state_dir, version_id).await {
    Err(e) if e.to_string().contains("大小与审核元数据不一致") => retry_with_backoff(),
    other => other?,
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-check reachability and content type before install
let resp = client.head(download_url).send().await?;
let size = resp.headers().get("content-length").and_then(|v| v.parse::<u64>().ok());
if let Some(len) = size { if len != expected.package_bytes as u64 { return Err("size mismatch ahead of install".into()); } }

Try / catch

match install_community_theme(&state_dir, version_id).await {
    Err(e) if e.to_string().contains("大小与审核元数据不一致") => retry_with_backoff(3),
    other => other?,
}

Prevention

When it happens

Trigger: Calling install_community_theme where the GET /v1/themes/{version_id}/download response length != metadata.package_bytes — e.g. connection drop mid-body, proxy/error page substituted for the ZIP, or the server-side file was changed after metadata was generated.

Common situations: Unstable network truncating a multi-MB ZIP download; a captive-portal or corporate proxy returning an HTML error page; CDN serving a partially uploaded or re-uploaded package; server-side package replaced without regenerating review metadata.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/8838342c1c4f50a0. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_community.rs:172

        serde_json::from_slice(&metadata_bytes).context("DreamSkin 主题元数据不是有效 JSON")?;
    validate_community_theme(&metadata)?;
    if metadata.id != version_id {
        bail!("DreamSkin 主题版本与请求不一致");
    }
    if !metadata.apply_compatible {
        bail!("该主题是旧格式,只支持在线预览或手动下载");
    }

    let download_url = format!("{COMMUNITY_API_ORIGIN}/v1/themes/{version_id}/download");
    let package = download_limited(
        &client,
        &download_url,
        metadata.package_bytes,
        "application/zip",
    )
    .await?;
    if package.len() != metadata.package_bytes {
        bail!("DreamSkin 主题包实际大小与审核元数据不一致");
    }
    let actual_sha = format!("{:x}", Sha256::digest(&package));
    if !actual_sha.eq_ignore_ascii_case(&metadata.package_sha256) {
        bail!("DreamSkin 主题包 SHA-256 与审核元数据不一致");
    }
    let validated = crate::dream_skin_package::validate_and_read_package(
        &package,
        if cfg!(windows) { "windows" } else { "macos" },
    )?;
    if validated.manifest.theme_id != metadata.theme_id
        || validated.manifest.version != metadata.version
    {
        bail!("DreamSkin 主题包身份与审核元数据不一致");
    }
    crate::dream_skin_library::save_validated_dream_skin_package(state_dir, &validated)
}

pub fn import_theme_package(

View on GitHub (pinned to b1ed92e5e4)