{"record":{"id":"b2d4916b3f192c73","repo":"BigPizzaV3/CodexPlusPlus","slug":"unsupported-dream-skin-image-format-extension","errorCode":null,"errorMessage":"unsupported Dream Skin image format: {extension}","messagePattern":"unsupported Dream Skin image format: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin.rs","lineNumber":142,"sourceCode":"\nfn supported_image_extension(path: &Path) -> anyhow::Result<String> {\n    let extension = path\n        .extension()\n        .and_then(|value| value.to_str())\n        .map(str::to_ascii_lowercase)\n        .ok_or_else(|| anyhow::anyhow!(\"unsupported Dream Skin image format\"))?;\n    #[cfg(target_os = \"macos\")]\n    let supported = matches!(\n        extension.as_str(),\n        \"png\" | \"jpg\" | \"jpeg\" | \"heic\" | \"tif\" | \"tiff\" | \"webp\"\n    );\n    #[cfg(not(target_os = \"macos\"))]\n    let supported = matches!(\n        extension.as_str(),\n        \"png\" | \"jpg\" | \"jpeg\" | \"webp\" | \"gif\" | \"bmp\"\n    );\n    if !supported {\n        bail!(\"unsupported Dream Skin image format: {extension}\");\n    }\n    Ok(extension)\n}\n\n#[cfg(target_os = \"macos\")]\nfn prepare_image(\n    source: &Path,\n    managed_dir: &Path,\n    _extension: &str,\n) -> anyhow::Result<(PathBuf, String)> {\n    let prepared = managed_dir.join(\".dream-skin-import.jpg\");\n    let output = std::process::Command::new(\"/usr/bin/sips\")\n        .args([\"-s\", \"format\", \"jpeg\"])\n        .arg(source)\n        .arg(\"--out\")\n        .arg(&prepared)\n        .output()\n        .context(\"failed to run macOS image converter\")?;","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin.rs#L124-L160","documentation":"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.","triggerScenarios":"Importing .avif, .svg, .jfif, or .psd files; using heic/tiff on Windows or Linux; using gif/bmp on macOS.","commonSituations":"avif images from modern phones and browsers; iPhone heic carried to a Windows machine; files whose extension does not match their real content.","solutions":["Convert the image to an allowed format (png or jpg) and retry","Fix files whose extension mislabels the real content","On macOS convert heic/tif via Preview export; elsewhere use png/jpg/webp/gif/bmp"],"exampleFix":"# before: importing photo.avif fails with 'unsupported Dream Skin image format: avif'\nimport_dream_skin_image(state_dir, dir, stem, &path.join(\"photo.avif\"))?;\n\n# after: convert first\n# macOS\nsips -s format png photo.avif --out photo.png\n# Linux (ImageMagick)\nmagick photo.avif photo.png\n# then import the png\nimport_dream_skin_image(state_dir, dir, stem, &path.join(\"photo.png\"))?;","handlingStrategy":"validation","validationCode":"fn is_supported_image(path: &std::path::Path) -> bool {\n    let Some(ext) = path.extension().and_then(|e| e.to_str()) else {\n        return false;\n    };\n    let ext = ext.to_ascii_lowercase();\n    if cfg!(target_os = \"macos\") {\n        matches!(ext.as_str(), \"png\" | \"jpg\" | \"jpeg\" | \"heic\" | \"tif\" | \"tiff\" | \"webp\")\n    } else {\n        matches!(ext.as_str(), \"png\" | \"jpg\" | \"jpeg\" | \"webp\" | \"gif\" | \"bmp\")\n    }\n}","typeGuard":"fn is_supported_image(path: &std::path::Path) -> bool {\n    let Some(ext) = path.extension().and_then(|e| e.to_str()) else {\n        return false;\n    };\n    let ext = ext.to_ascii_lowercase();\n    if cfg!(target_os = \"macos\") {\n        matches!(ext.as_str(), \"png\" | \"jpg\" | \"jpeg\" | \"heic\" | \"tif\" | \"tiff\" | \"webp\")\n    } else {\n        matches!(ext.as_str(), \"png\" | \"jpg\" | \"jpeg\" | \"webp\" | \"gif\" | \"bmp\")\n    }\n}","tryCatchPattern":null,"preventionTips":["Filter the file picker to the platform allowlist","Note the allowlists differ: heic/tiff are macOS-only; gif/bmp are non-macOS only","Extensions are trusted as-is - a lying extension resurfaces later as an empty or conversion error"],"tags":["dream-skin","file-format","image","platform-specific","rust"],"backgroundTag":"unsupported-file-format","analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}