BigPizzaV3/CodexPlusPlus · error

主题包必须且只能包含一个背景图片

Error message

主题包必须且只能包含一个背景图片

What it means

Structural guard in validate_and_read_package: the package must contain exactly one background image among background.webp/background.jpg/background.png — zero found raises the 'must contain' context error, and more than one raises this error. Ambiguity over which image is the wallpaper is not permitted.

Source

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

    let manifest_bytes = files
        .remove("manifest.json")
        .context("主题包缺少 manifest.json")?;
    let theme_bytes = files
        .remove("theme.json")
        .context("主题包缺少 theme.json")?;
    let css_bytes = files.remove("theme.css").context("主题包缺少 theme.css")?;
    let image_name = ["background.webp", "background.jpg", "background.png"]
        .iter()
        .find(|name| files.contains_key(**name))
        .map(|name| (*name).to_string())
        .context("主题包必须包含一个背景图片")?;
    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)?;

View on GitHub (pinned to f2074595a2)

Solutions

  1. Include exactly one background.webp, background.jpg, or background.png
  2. Remove duplicate background images, keeping one
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_package.rs:158 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/577937a243a2ea4d. Report an issue: GitHub.