BigPizzaV3/CodexPlusPlus · error

主题包包含未处理文件

Error message

主题包包含未处理文件

What it means

validate_and_read_package unpacks a Dream Skin ZIP, strips the known entries (manifest.json, theme.json, theme.css, one background image, optional LICENSE.txt and manifest.sig) and then asserts the file set is fully consumed. If any non-directory entry survives that removal, the package contains a file the format does not define, so it bails with '主题包包含未处理文件'. This is a last-line guard: every other stray filename should already have been caught by the ALLOWED_FILES check earlier, so reaching this point means the file had an allowed name but the wrong count/role (e.g. a second background image variant).

Solutions

  1. Open the ZIP and list its entries; keep only manifest.json, theme.json, theme.css, exactly one background.{webp,jpg,png}, and optionally LICENSE.txt and manifest.sig
  2. Repackage the theme with only the allowed files at the root (or in a single top-level directory) and retry validate_and_read_package
  3. If the package is from a newer publisher format, upgrade the client library so the new entry is recognized and consumed

Example fix

// before: package ships background.png + background.jpg + README.md
// after: repackage
cargo_package/
  manifest.json
  manifest.sig
  theme.json
  theme.css
  background.png
  LICENSE.txt
Defensive patterns

Strategy: validation

Validate before calling

fn has_only_allowed_entries(zip_names: &[&str]) -> bool {
    const ALLOWED: &[&str] = &["manifest.json","manifest.sig","theme.json","theme.css","background.webp","background.jpg","background.png","LICENSE.txt"];
    let files: Vec<&str> = zip_names.iter().filter(|n| !n.ends_with('/')).map(|n| n.rsplit('/').next().unwrap()).collect();
    files.iter().all(|f| ALLOWED.contains(f))
        && files.iter().filter(|f| f.starts_with("background.")).count() == 1
}

Type guard

fn is_allowed_package_file(name: &str) -> bool {
    matches!(name, "manifest.json" | "manifest.sig" | "theme.json" | "theme.css" | "background.webp" | "background.jpg" | "background.png" | "LICENSE.txt")
}

Try / catch

match validate_and_read_package(&bytes, platform) {
    Ok(pkg) => install(pkg),
    Err(e) if e.to_string().contains("未处理文件") => reject_package("unsupported extra files in package"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling validate_and_read_package on a ZIP that, after removing manifest.json/theme.json/theme.css/the single image/LICENSE.txt/manifest.sig, still has entries left — e.g. a package shipping two background images (should have failed earlier with '必须且只能包含一个背景图片' if both are images, but a package with an unexpected allowed-named file the code forgot to consume), or a future/renamed entry that slipped past base-name checks.

Common situations: Hand-built theme packages where an author added an extra file (a second background, a README with an allowed-looking name, thumbnails); packaging tools emitting extras like .DS_Store variants in odd locations; version drift where a newer package format includes a file this client version doesn't know.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_package.rs:170

    if ["background.webp", "background.jpg", "background.png"]
        .iter()
        .filter(|name| files.contains_key(**name))
        .count()
        != 1
    {
        bail!("主题包必须且只能包含一个背景图片");
    }
    let image_bytes = files.remove(&image_name).expect("image was checked above");
    validate_image_content(&image_name, &image_bytes)?;
    let license_bytes = files.remove("LICENSE.txt");
    let signature = files.remove("manifest.sig");
    if let Some(signature) = signature {
        if signature.len() > SIGNATURE_LIMIT {
            bail!("manifest.sig 超过大小限制");
        }
    }
    if !files.is_empty() {
        bail!("主题包包含未处理文件");
    }

    let manifest: DreamSkinPackageManifest = parse_json(&manifest_bytes, "manifest.json")?;
    validate_manifest(&manifest, platform)?;
    let theme: Value = parse_json(&theme_bytes, "theme.json")?;
    validate_theme(&theme, &manifest, &image_name)?;
    let css = String::from_utf8(css_bytes).context("theme.css 不是有效 UTF-8")?;
    validate_safe_css(&css)?;
    validate_manifest_files(
        &manifest,
        &manifest_bytes,
        &theme_bytes,
        css.as_bytes(),
        &image_name,
        &image_bytes,
        license_bytes.as_deref(),
    )?;

View on GitHub (pinned to b1ed92e5e4)