BigPizzaV3/CodexPlusPlus · error

unsupported Dream Skin image format

Error message

unsupported Dream Skin image format: {extension}

What it means

supported_image_extension extracts the file extension (lowercased) and checks it against the platform's supported image formats; on non-macOS targets that is png/jpg/jpeg/webp/gif/bmp. Unknown extensions bail with this message, ensuring the Dream Skin pipeline only processes formats its converter can handle.

Solutions

  1. Convert the image to a supported format first: 'magick input.heic output.png' (or export as PNG/JPEG from the source app).
  2. Rename the file with its correct extension if the format is actually supported but mislabeled (e.g. a JPEG saved without extension).
  3. On macOS check which formats the native prepare_image path accepts; on other platforms stick to png/jpg/jpeg/webp/gif/bmp.
  4. If a format (e.g. avif) should be supported, extend the matches! list in supported_image_extension and the corresponding prepare pipeline.

Example fix

// before
import_dream_skin_image(Path::new("photo.heic"), dir, stem)?; // unsupported
// after
// magick photo.heic photo.png
import_dream_skin_image(Path::new("photo.png"), dir, stem)?;
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(["png", "jpg", "jpeg", "webp", "gif", "bmp"]);
const ext = path.split(".").pop()?.toLowerCase() ?? "";
if (!SUPPORTED.has(ext)) throw new Error(`convert ${ext} to png before import`);

Type guard

fn has_supported_image_extension(p: &std::path::Path) -> bool {
    p.extension()
        .and_then(|e| e.to_str())
        .map_or(false, |e| matches!(e.to_lowercase().as_str(), "png" | "jpg" | "jpeg" | "webp" | "gif" | "bmp"))
}

Prevention

When it happens

Trigger: import_dream_skin_image is called with a source file whose extension (after the final '.', lowercased) is not in the supported set — e.g. .tiff, .heic, .avif, .svg, or a file with no extension.

Common situations: iPhone photos saved as .heic; modern .avif downloads; vector .svg logos; camera .tiff exports; extensionless files dragged from temp folders.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

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