BigPizzaV3/CodexPlusPlus · error

unsupported Dream Skin package image

Error message

unsupported Dream Skin package image: {other}

What it means

save_validated_dream_skin_package only accepts a fixed set of image file names for a Dream Skin package: background.webp, background.jpg, or background.png. Any other image_name hits the catch-all arm and bails with "unsupported Dream Skin package image: {other}".

Solutions

  1. Rename the package image to one of the accepted names (background.webp, background.jpg, or background.png) before saving
  2. Convert unsupported formats (gif, svg, bmp) to webp/jpg/png
  3. Check the code that builds the package to ensure it derives image_name from the required constant, not user input or file base names

Example fix

// before
let pkg = DreamSkinThemePackage { image_name: "cover.jpeg".into(), ... };
// after
let pkg = DreamSkinThemePackage { image_name: "background.jpg".into(), ... };
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED: [&str; 3] = ["background.webp", "background.jpg", "background.png"];
if !ALLOWED.contains(&package.image_name.as_str()) {
    return Err(anyhow::anyhow!("image_name must be one of {:?}, got '{}'", ALLOWED, package.image_name));
}

Type guard

fn is_supported_image_name(name: &str) -> bool {
    matches!(name, "background.webp" | "background.jpg" | "background.png")
}

Try / catch

match save_validated_dream_skin_package(&state_dir, &pkg) {
    Ok(()) => {},
    Err(e) if e.to_string().contains("unsupported Dream Skin package image") => prompt_user("rename the image to background.webp/jpg/png and re-import"),
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling save_validated_dream_skin_package with package.image_name set to anything other than "background.webp"/"background.jpg"/"background.png" (e.g. "background.gif", "cover.jpeg", "bg.png", or an absolute path).

Common situations: Importing a theme package built by an external tool that used different image names or extensions (jpeg vs jpg, svg, gif); hand-assembling a DreamSkinThemePackage and forgetting the required naming convention.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_library.rs:337

            .context("同 ID 本地主题无法确认身份,已拒绝覆盖")?;
        if existing.config.id != config.id {
            bail!("同 ID 本地主题身份不一致,已拒绝覆盖");
        }
    }
    let suffix = unique_suffix();
    let staging = themes_dir.join(format!(".stage-{}-{suffix}", config.id));
    std::fs::create_dir(&staging).with_context(|| {
        format!(
            "failed to create Dream Skin package staging directory {}",
            staging.display()
        )
    })?;
    let staged = (|| -> anyhow::Result<()> {
        let image_extension = match package.image_name.as_str() {
            "background.webp" => "webp",
            "background.jpg" => "jpg",
            "background.png" => "png",
            other => bail!("unsupported Dream Skin package image: {other}"),
        };
        crate::settings::atomic_write(
            &staging.join(format!("image.{image_extension}")),
            &package.image_bytes,
        )?;
        crate::settings::atomic_write(
            &staging.join(THEME_CONFIG_FILE),
            &serde_json::to_vec_pretty(&config)?,
        )?;
        crate::settings::atomic_write(&staging.join("theme.css"), package.css.as_bytes())?;
        crate::settings::atomic_write(&staging.join("manifest.json"), &package.manifest_bytes)?;
        if let Some(license) = &package.license_bytes {
            crate::settings::atomic_write(&staging.join("LICENSE.txt"), license)?;
        }
        Ok(())
    })();
    if let Err(error) = staged {
        let _ = remove_known_theme_directory(&staging);

View on GitHub (pinned to b1ed92e5e4)