{"record":{"id":"1c510268a493d317","repo":"BigPizzaV3/CodexPlusPlus","slug":"unsupported-dream-skin-image-format","errorCode":null,"errorMessage":"unsupported Dream Skin image format","messagePattern":"unsupported Dream Skin image format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin.rs","lineNumber":131,"sourceCode":"pub fn is_managed_dream_skin_image(path: &Path, state_dir: &Path) -> bool {\n    if !is_managed_image_name(path) || !path.is_file() {\n        return false;\n    }\n    let Ok(path) = std::fs::canonicalize(path) else {\n        return false;\n    };\n    let Ok(root) = std::fs::canonicalize(state_dir.join(MANAGED_THEME_DIR)) else {\n        return false;\n    };\n    path.parent().is_some_and(|parent| parent == root)\n}\n\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(","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin.rs#L113-L149","documentation":"Thrown by supported_image_extension when a Dream Skin image path has no file extension at all (or the extension is not valid UTF-8 / non-string). The extension is needed to decide how to process/copy the image (and on macOS, whether Core Graphics conversion is required).","triggerScenarios":"prepare_dream_skin_image_for_directory receiving a Path with path.extension() == None — e.g. a file named 'wallpaper', a dotfile like '.hidden', or a path whose extension bytes are not valid Unicode.","commonSituations":"Picking a downloaded file that lost its extension; macOS screenshots or assets renamed without extension; importing an image via drag-and-drop from an app that strips extensions.","solutions":["Rename the file so it has a proper image extension (e.g. wallpaper.png)","Re-export/download the image in PNG or JPG format","Verify the extension is plain ASCII/UTF-8 (avoid non-Unicode bytes in filenames)"],"exampleFix":"// before\nmv wallpaper wallpaper.png\n// after (import with a recognized extension)\nprepare_dream_skin_image_for_directory(Path::new(\"wallpaper.png\"), ...)","handlingStrategy":"validation","validationCode":"fn has_supported_image_extension(path: &std::path::Path) -> bool {\n    path.extension()\n        .and_then(|e| e.to_str())\n        .map(|e| {\n            let e = e.to_ascii_lowercase();\n            matches!(e.as_str(), \"png\"|\"jpg\"|\"jpeg\"|\"heic\"|\"tif\"|\"tiff\"|\"webp\")\n        })\n        .unwrap_or(false)\n}","typeGuard":"fn valid_extension(path: &std::path::Path) -> Option<String> {\n    path.extension()?.to_str().map(|e| e.to_ascii_lowercase())\n}","tryCatchPattern":null,"preventionTips":["Only pass files with recognized image extensions into Dream Skin APIs","Re-download images that arrive without extensions instead of renaming blindly","Validate user-selected paths before invoking prepare_dream_skin_image_for_directory"],"tags":["image","validation","rust"],"backgroundTag":"invalid-argument-format","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"}