{"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":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin.rs","lineNumber":143,"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":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin.rs#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"iPhone photos saved as .heic; modern .avif downloads; vector .svg logos; camera .tiff exports; extensionless files dragged from temp folders.","solutions":["Convert the image to a supported format first: 'magick input.heic output.png' (or export as PNG/JPEG from the source app).","Rename the file with its correct extension if the format is actually supported but mislabeled (e.g. a JPEG saved without extension).","On macOS check which formats the native prepare_image path accepts; on other platforms stick to png/jpg/jpeg/webp/gif/bmp.","If a format (e.g. avif) should be supported, extend the matches! list in supported_image_extension and the corresponding prepare pipeline."],"exampleFix":"// before\nimport_dream_skin_image(Path::new(\"photo.heic\"), dir, stem)?; // unsupported\n// after\n// magick photo.heic photo.png\nimport_dream_skin_image(Path::new(\"photo.png\"), dir, stem)?;","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\"png\", \"jpg\", \"jpeg\", \"webp\", \"gif\", \"bmp\"]);\nconst ext = path.split(\".\").pop()?.toLowerCase() ?? \"\";\nif (!SUPPORTED.has(ext)) throw new Error(`convert ${ext} to png before import`);","typeGuard":"fn has_supported_image_extension(p: &std::path::Path) -> bool {\n    p.extension()\n        .and_then(|e| e.to_str())\n        .map_or(false, |e| matches!(e.to_lowercase().as_str(), \"png\" | \"jpg\" | \"jpeg\" | \"webp\" | \"gif\" | \"bmp\"))\n}","tryCatchPattern":null,"preventionTips":["Standardize on PNG or JPEG for all theme sources","Convert HEIC/AVIF/TIFF files up front (ImageMagick, sips)","Filter file pickers to accepted extensions and validate again server-side"],"tags":["validation","image-processing","unsupported-format"],"backgroundTag":"unsupported-operation","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}