BigPizzaV3/CodexPlusPlus · error · anyhow::Error

unsupported Dream Skin image format: {extension}

Error message

unsupported Dream Skin image format: {extension}

What it means

supported_image_extension lowercases the file extension and matches it against a per-OS allowlist: non-macOS accepts png/jpg/jpeg/webp/gif/bmp; macOS accepts png/jpg/jpeg/heic/tif/tiff/webp. Any other extension - or an OS-mismatched one such as heic on Windows or gif on macOS - bails, naming the offending extension.

Source

Thrown at crates/codex-plus-core/src/dream_skin.rs:142

fn supported_image_extension(path: &Path) -> anyhow::Result<String> {
    let extension = path
        .extension()
        .and_then(|value| value.to_str())
        .map(str::to_ascii_lowercase)
        .ok_or_else(|| anyhow::anyhow!("unsupported Dream Skin image format"))?;
    #[cfg(target_os = "macos")]
    let supported = matches!(
        extension.as_str(),
        "png" | "jpg" | "jpeg" | "heic" | "tif" | "tiff" | "webp"
    );
    #[cfg(not(target_os = "macos"))]
    let supported = matches!(
        extension.as_str(),
        "png" | "jpg" | "jpeg" | "webp" | "gif" | "bmp"
    );
    if !supported {
        bail!("unsupported Dream Skin image format: {extension}");
    }
    Ok(extension)
}

#[cfg(target_os = "macos")]
fn prepare_image(
    source: &Path,
    managed_dir: &Path,
    _extension: &str,
) -> anyhow::Result<(PathBuf, String)> {
    let prepared = managed_dir.join(".dream-skin-import.jpg");
    let output = std::process::Command::new("/usr/bin/sips")
        .args(["-s", "format", "jpeg"])
        .arg(source)
        .arg("--out")
        .arg(&prepared)
        .output()
        .context("failed to run macOS image converter")?;

View on GitHub (pinned to f2074595a2)

Solutions

  1. Convert the image to an allowed format (png or jpg) and retry
  2. Fix files whose extension mislabels the real content
  3. On macOS convert heic/tif via Preview export; elsewhere use png/jpg/webp/gif/bmp

Example fix

# before: importing photo.avif fails with 'unsupported Dream Skin image format: avif'
import_dream_skin_image(state_dir, dir, stem, &path.join("photo.avif"))?;

# after: convert first
# macOS
sips -s format png photo.avif --out photo.png
# Linux (ImageMagick)
magick photo.avif photo.png
# then import the png
import_dream_skin_image(state_dir, dir, stem, &path.join("photo.png"))?;
Defensive patterns

Strategy: validation

Validate before calling

fn is_supported_image(path: &std::path::Path) -> bool {
    let Some(ext) = path.extension().and_then(|e| e.to_str()) else {
        return false;
    };
    let ext = ext.to_ascii_lowercase();
    if cfg!(target_os = "macos") {
        matches!(ext.as_str(), "png" | "jpg" | "jpeg" | "heic" | "tif" | "tiff" | "webp")
    } else {
        matches!(ext.as_str(), "png" | "jpg" | "jpeg" | "webp" | "gif" | "bmp")
    }
}

Type guard

fn is_supported_image(path: &std::path::Path) -> bool {
    let Some(ext) = path.extension().and_then(|e| e.to_str()) else {
        return false;
    };
    let ext = ext.to_ascii_lowercase();
    if cfg!(target_os = "macos") {
        matches!(ext.as_str(), "png" | "jpg" | "jpeg" | "heic" | "tif" | "tiff" | "webp")
    } else {
        matches!(ext.as_str(), "png" | "jpg" | "jpeg" | "webp" | "gif" | "bmp")
    }
}

Prevention

When it happens

Trigger: Importing .avif, .svg, .jfif, or .psd files; using heic/tiff on Windows or Linux; using gif/bmp on macOS.

Common situations: avif images from modern phones and browsers; iPhone heic carried to a Windows machine; files whose extension does not match their real content.

Related errors


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