BigPizzaV3/CodexPlusPlus · error · anyhow::Error

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

Error message

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

What it means

The downloaded package's byte length must exactly equal metadata.package_bytes from the reviewed metadata (which also served as the download cap). A different length means a truncated transfer or an artifact that changed server-side after review; the install aborts before the zip is parsed.

Source

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

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

Solutions

  1. Retry the install - truncation is the common cause and a retry re-downloads
  2. Refresh the catalog so metadata and artifact re-sync, then retry
  3. A persistent mismatch means reviewed metadata is stale - report the theme
Defensive patterns

Strategy: retry

Try / catch

On the '实际大小与审核元数据不一致' error, retry install_community_theme once or twice with freshly fetched metadata; a stable mismatch is server-side artifact drift - surface it as a reportable gallery issue rather than retrying forever.

Prevention

When it happens

Trigger: Connection cut mid-download inside the 120-second window; the zip re-uploaded after review with a different size; a proxy or antivirus altering the body.

Common situations: Flaky networks during multi-MiB downloads; corporate proxies rewriting zips; gallery artifact updated between catalog fetch and install.

Related errors


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