{"record":{"id":"56a41bd6dca031dd","repo":"BigPizzaV3/CodexPlusPlus","slug":"current-dream-skin-theme-cannot-be-deleted","errorCode":null,"errorMessage":"current Dream Skin theme cannot be deleted","messagePattern":"current Dream Skin theme cannot be deleted","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":495,"sourceCode":"                .with_context(|| format!(\"failed to remove old image {}\", path.display()))?;\n        }\n    }\n    Ok(DreamSkinActivation {\n        config: draft.config.clone(),\n        active_image_path: active_image.to_string_lossy().into_owned(),\n    })\n}\n\npub fn delete_dream_skin_theme(\n    state_dir: &Path,\n    id: &str,\n    active_id: Option<&str>,\n) -> anyhow::Result<()> {\n    if !valid_theme_id(id) {\n        bail!(\"invalid Dream Skin theme id\");\n    }\n    if active_id.is_some_and(|active| active == id) {\n        bail!(\"current Dream Skin theme cannot be deleted\");\n    }\n    let directory = state_dir.join(THEMES_DIR).join(id);\n    let metadata = std::fs::symlink_metadata(&directory)\n        .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 stored = load_stored_dream_skin_theme(state_dir, id)?;\n    if stored.config.id == DreamSkinThemeConfig::default().id {\n        bail!(\"built-in Dream Skin theme cannot be deleted\");\n    }\n    remove_known_theme_directory(&directory)\n}\n\nfn validate_theme_draft(draft: &DreamSkinThemeDraft) -> anyhow::Result<()> {\n    if draft.builtin {\n        bail!(\"built-in Dream Skin theme is read-only\");\n    }","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin_library.rs#L477-L513","documentation":"Guard in delete_dream_skin_theme: the requested theme id equals the currently active theme, so deleting it would leave the active slot dangling. Deletion is refused; the user must activate another theme first.","triggerScenarios":"Thrown at crates/codex-plus-core/src/dream_skin_library.rs:495 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Activate a different theme before deleting this one","Choose a non-active theme in the delete UI","No repair needed; the refusal is intended behavior"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}