{"record":{"id":"4d2fc91936d3c115","repo":"BigPizzaV3/CodexPlusPlus","slug":"dream-skin-theme-directory-contains-unknown-entry","errorCode":null,"errorMessage":"Dream Skin theme directory contains unknown entry: {name}","messagePattern":"Dream Skin theme directory contains unknown entry: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":639,"sourceCode":"    Ok(())\n}\n\nfn ensure_known_theme_directory(directory: &Path) -> anyhow::Result<()> {\n    for entry in std::fs::read_dir(directory)? {\n        let path = entry?.path();\n        let name = path\n            .file_name()\n            .and_then(|value| value.to_str())\n            .unwrap_or(\"\");\n        let metadata = std::fs::symlink_metadata(&path)?;\n        let known = metadata.file_type().is_file()\n            && !metadata.file_type().is_symlink()\n            && (name == THEME_CONFIG_FILE\n                || name == \".dream-skin-import.jpg\"\n                || (name.starts_with(\"image.\") && supported_image_extension(&path))\n                || matches!(name, \"theme.css\" | \"manifest.json\" | \"LICENSE.txt\"));\n        if !known {\n            bail!(\"Dream Skin theme directory contains unknown entry: {name}\");\n        }\n    }\n    Ok(())\n}\n\nfn remove_known_theme_directory(directory: &Path) -> anyhow::Result<()> {\n    if !directory.exists() {\n        return Ok(());\n    }\n    ensure_known_theme_directory(directory)?;\n    for entry in std::fs::read_dir(directory)? {\n        let path = entry?.path();\n        std::fs::remove_file(&path)\n            .with_context(|| format!(\"failed to remove {}\", path.display()))?;\n    }\n    std::fs::remove_dir(directory)\n        .with_context(|| format!(\"failed to remove {}\", directory.display()))?;\n    Ok(())","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_library.rs#L621-L657","documentation":"ensure_known_theme_directory scans an existing Dream Skin theme directory before it is backed up/removed and bails if any entry is not one of the whitelisted theme files (theme.json/.dream-skin-import.jpg/image.* with a supported extension/theme.css/manifest.json/LICENSE.txt). Regular files only are accepted: subdirectories and symlinks are also reported as unknown entries. This protects the replace/remove flow from deleting user data it does not recognize.","triggerScenarios":"replace_theme_directory or remove_known_theme_directory is called on a target theme directory that contains any extra file (e.g. an OS artifact like .DS_Store or Thumbs.db, a downloaded README, an editor backup, a nested subfolder) or a symlinked entry.","commonSituations":"Users manually added files (screenshots, notes, extra CSS) into a theme folder; macOS/Windows metadata files (Thumbs.db, desktop.ini, .DS_Store) were created inside the directory; a theme exported by a third-party tool includes subdirectories; a symlinked theme directory shared from dotfiles.","solutions":["Inspect the theme directory and move out or delete any file that is not part of the known theme file set (theme.json, image.*, theme.css, manifest.json, LICENSE.txt, .dream-skin-import.jpg)","Remove hidden OS metadata files (.DS_Store, Thumbs.db, desktop.ini) from the directory","If the theme ships extra assets, ask the theme author to embed them in theme.css/theme.json rather than as extra files, or reinstall the theme from the market","Delete the existing theme directory manually (after backing up) so the install can recreate a clean one"],"exampleFix":"# before\ndream-skin/themes/my-theme/\n  theme.json\n  theme.css\n  screenshot.png      <- unknown entry\n# after\ndream-skin/themes/my-theme/\n  theme.json\n  theme.css\n  image.screenshot.png  <- rename to an accepted image.* name (with supported extension) or remove the file","handlingStrategy":"validation","validationCode":"fn has_only_known_entries(dir: &Path) -> std::io::Result<bool> {\n    const KNOWN: [&str; 5] = [\"theme.json\", \".dream-skin-import.jpg\", \"theme.css\", \"manifest.json\", \"LICENSE.txt\"];\n    for entry in std::fs::read_dir(dir)? {\n        let p = entry?.path();\n        let md = std::fs::symlink_metadata(&p)?;\n        if !md.file_type().is_file() { return Ok(false); }\n        let name = p.file_name().and_then(|n| n.to_str()).unwrap_or(\"\");\n        let ok = KNOWN.contains(&name)\n            || (name.starts_with(\"image.\") && p.extension().map_or(false, |e| [\"png\",\"jpg\",\"jpeg\",\"webp\"].contains(&e.to_str().unwrap_or(\"\"))));\n        if !ok { return Ok(false); }\n    }\n    Ok(true)\n}","typeGuard":"fn is_plain_file(p: &Path) -> bool {\n    std::fs::symlink_metadata(p).map(|m| m.file_type().is_file() && !m.file_type().is_symlink()).unwrap_or(false)\n}","tryCatchPattern":"match save_validated_dream_skin_package(...) {\n    Ok(summary) => println!(\"installed {}\", summary.id),\n    Err(e) if e.to_string().contains(\"unknown entry\") => {\n        eprintln!(\"theme dir has unrecognized files; clean it and retry: {e}\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Never hand-edit files inside installed theme directories; use the library's save APIs","Exclude OS metadata files (.DS_Store, Thumbs.db) from any sync tool that touches the themes folder","Package themes with only the whitelisted filenames and no subdirectories","Before replacing a theme, list its contents and confirm only known entries exist"],"tags":["filesystem","theme-management","validation"],"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"}