{"record":{"id":"8ab615e6e3f2f725","repo":"BigPizzaV3/CodexPlusPlus","slug":"unsupported-dream-skin-package-image-other","errorCode":null,"errorMessage":"unsupported Dream Skin package image: {other}","messagePattern":"unsupported Dream Skin package image: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":337,"sourceCode":"            .context(\"同 ID 本地主题无法确认身份，已拒绝覆盖\")?;\n        if existing.config.id != config.id {\n            bail!(\"同 ID 本地主题身份不一致，已拒绝覆盖\");\n        }\n    }\n    let suffix = unique_suffix();\n    let staging = themes_dir.join(format!(\".stage-{}-{suffix}\", config.id));\n    std::fs::create_dir(&staging).with_context(|| {\n        format!(\n            \"failed to create Dream Skin package staging directory {}\",\n            staging.display()\n        )\n    })?;\n    let staged = (|| -> anyhow::Result<()> {\n        let image_extension = match package.image_name.as_str() {\n            \"background.webp\" => \"webp\",\n            \"background.jpg\" => \"jpg\",\n            \"background.png\" => \"png\",\n            other => bail!(\"unsupported Dream Skin package image: {other}\"),\n        };\n        crate::settings::atomic_write(\n            &staging.join(format!(\"image.{image_extension}\")),\n            &package.image_bytes,\n        )?;\n        crate::settings::atomic_write(\n            &staging.join(THEME_CONFIG_FILE),\n            &serde_json::to_vec_pretty(&config)?,\n        )?;\n        crate::settings::atomic_write(&staging.join(\"theme.css\"), package.css.as_bytes())?;\n        crate::settings::atomic_write(&staging.join(\"manifest.json\"), &package.manifest_bytes)?;\n        if let Some(license) = &package.license_bytes {\n            crate::settings::atomic_write(&staging.join(\"LICENSE.txt\"), license)?;\n        }\n        Ok(())\n    })();\n    if let Err(error) = staged {\n        let _ = remove_known_theme_directory(&staging);","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_library.rs#L319-L355","documentation":"save_validated_dream_skin_package only accepts a fixed set of image file names for a Dream Skin package: background.webp, background.jpg, or background.png. Any other image_name hits the catch-all arm and bails with \"unsupported Dream Skin package image: {other}\".","triggerScenarios":"Calling save_validated_dream_skin_package with package.image_name set to anything other than \"background.webp\"/\"background.jpg\"/\"background.png\" (e.g. \"background.gif\", \"cover.jpeg\", \"bg.png\", or an absolute path).","commonSituations":"Importing a theme package built by an external tool that used different image names or extensions (jpeg vs jpg, svg, gif); hand-assembling a DreamSkinThemePackage and forgetting the required naming convention.","solutions":["Rename the package image to one of the accepted names (background.webp, background.jpg, or background.png) before saving","Convert unsupported formats (gif, svg, bmp) to webp/jpg/png","Check the code that builds the package to ensure it derives image_name from the required constant, not user input or file base names"],"exampleFix":"// before\nlet pkg = DreamSkinThemePackage { image_name: \"cover.jpeg\".into(), ... };\n// after\nlet pkg = DreamSkinThemePackage { image_name: \"background.jpg\".into(), ... };","handlingStrategy":"validation","validationCode":"const ALLOWED: [&str; 3] = [\"background.webp\", \"background.jpg\", \"background.png\"];\nif !ALLOWED.contains(&package.image_name.as_str()) {\n    return Err(anyhow::anyhow!(\"image_name must be one of {:?}, got '{}'\", ALLOWED, package.image_name));\n}","typeGuard":"fn is_supported_image_name(name: &str) -> bool {\n    matches!(name, \"background.webp\" | \"background.jpg\" | \"background.png\")\n}","tryCatchPattern":"match save_validated_dream_skin_package(&state_dir, &pkg) {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"unsupported Dream Skin package image\") => prompt_user(\"rename the image to background.webp/jpg/png and re-import\"),\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Normalize external theme packages on import (convert formats, enforce canonical file names)","Never pass user-supplied file names straight into image_name","Share a single constant list of accepted image names between packaging code and validation UI"],"tags":["unsupported-format","validation","invalid-argument"],"backgroundTag":"invalid-argument-value","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"}