{"record":{"id":"cef43783cf54d8d3","repo":"BigPizzaV3/CodexPlusPlus","slug":"dream-skin-theme-must-contain-exactly-one-image","errorCode":null,"errorMessage":"Dream Skin theme must contain exactly one image","messagePattern":"Dream Skin theme must contain exactly one image","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":393,"sourceCode":"        .with_context(|| format!(\"Dream Skin theme not found: {id}\"))?;\n    if !metadata.file_type().is_dir() || metadata.file_type().is_symlink() {\n        bail!(\"Dream Skin theme path is not a safe directory\");\n    }\n    let config_path = directory.join(THEME_CONFIG_FILE);\n    let metadata = std::fs::symlink_metadata(&config_path)\n        .with_context(|| format!(\"Dream Skin theme config not found: {id}\"))?;\n    if !metadata.file_type().is_file()\n        || metadata.file_type().is_symlink()\n        || metadata.len() > THEME_CONFIG_LIMIT\n    {\n        bail!(\"invalid Dream Skin theme config\");\n    }\n    let config: DreamSkinThemeConfig = serde_json::from_slice(&std::fs::read(&config_path)?)?;\n    if config.id != id {\n        bail!(\"Dream Skin theme id does not match directory\");\n    }\n    let image = find_theme_image(&directory)\n        .ok_or_else(|| anyhow::anyhow!(\"Dream Skin theme must contain exactly one image\"))?;\n    let draft = DreamSkinThemeDraft {\n        config,\n        image_path: image.to_string_lossy().into_owned(),\n        builtin: false,\n    };\n    validate_theme_draft(&draft)?;\n    Ok(draft)\n}\n\npub fn rename_dream_skin_theme(\n    state_dir: &Path,\n    id: &str,\n    name: &str,\n) -> anyhow::Result<DreamSkinThemeSummary> {\n    let mut draft = load_stored_dream_skin_theme(state_dir, id)?;\n    draft.config.name = name.trim().to_string();\n    save_dream_skin_theme(state_dir, &draft)\n}","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_library.rs#L375-L411","documentation":"Thrown by load_stored_dream_skin_theme when the theme directory on disk contains no image file matching the expected extensions. A stored theme must have exactly one image next to its theme.json config; find_theme_image returned None so the stored theme is incomplete or corrupt.","triggerScenarios":"Loading/renaming/deleting a stored theme whose image file was manually deleted, renamed with an unsupported extension, or never written by save_validated_dream_skin_package.","commonSituations":"User manually cleaned the theme directory and removed the image; backup/restore tooling copied only theme.json; a partial write left the directory without the image; the image was renamed to an extension find_theme_image does not scan.","solutions":["Restore the image file into the theme directory with its original name and extension","Recreate the theme from the source image via create_dream_skin_theme_from_image","Delete the broken theme entry and re-add it through the app UI"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if !theme_dir.join(\"theme.json\").exists() {\n    return Err(\"theme.json missing\".into());\n}\nlet has_image = std::fs::read_dir(&theme_dir)?\n    .filter_map(Result::ok)\n    .any(|e| {\n        e.path().extension()\n            .and_then(|x| x.to_str())\n            .map(|x| matches!(x.to_ascii_lowercase().as_str(), \"png\"|\"jpg\"|\"jpeg\"|\"heic\"|\"tif\"|\"tiff\"|\"webp\"))\n            .unwrap_or(false)\n    });\nif !has_image { return Err(\"theme directory has no image\".into()); }","typeGuard":null,"tryCatchPattern":"match load_stored_dream_skin_theme(&dir, &id) {\n    Err(e) if e.to_string().contains(\"must contain exactly one image\") => {\n        // treat as corrupt theme: offer re-import UI\n    }\n    other => other?,\n}","preventionTips":["Never manually delete or rename files inside stored theme directories","Use the app's delete/re-import flows instead of filesystem cleanup tools","When backing up themes, copy the entire directory including the image"],"tags":["filesystem","validation","theme"],"backgroundTag":"file-not-found","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"}