{"record":{"id":"981a5be358fad1a3","repo":"BigPizzaV3/CodexPlusPlus","slug":"invalid-built-in-dream-skin-theme-draft","errorCode":null,"errorMessage":"invalid built-in Dream Skin theme draft","messagePattern":"invalid built-in Dream Skin theme draft","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":419,"sourceCode":"}\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}\n\npub fn prepare_dream_skin_activation(\n    state_dir: &Path,\n    draft: &DreamSkinThemeDraft,\n) -> anyhow::Result<DreamSkinActivation> {\n    if draft.builtin {\n        if draft.config != DreamSkinThemeConfig::default() || !draft.image_path.trim().is_empty() {\n            bail!(\"invalid built-in Dream Skin theme draft\");\n        }\n        crate::dream_skin::clear_managed_dream_skin_image(state_dir)?;\n        return Ok(DreamSkinActivation {\n            config: draft.config.clone(),\n            active_image_path: String::new(),\n        });\n    }\n    validate_theme_draft(draft)?;\n    let managed_dir = state_dir.join(\"dream-skin/theme\");\n    let source = Path::new(draft.image_path.trim());\n    let active_image = if let Some(extension) = stored_theme_image_extension(state_dir, source) {\n        std::fs::create_dir_all(&managed_dir)\n            .with_context(|| format!(\"failed to create {}\", managed_dir.display()))?;\n        let destination = managed_dir.join(format!(\"current.{extension}\"));\n        let bytes = std::fs::read(source)\n            .with_context(|| format!(\"failed to read Dream Skin image {}\", source.display()))?;\n        crate::settings::atomic_write(&destination, &bytes).with_context(|| {\n            format!(\"failed to store Dream Skin image {}\", destination.display())","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin_library.rs#L401-L437","documentation":"Guard in prepare_dream_skin_activation: a draft marked builtin must be exactly the default config with no custom image path; any deviation means the built-in theme was tampered with or corrupted, so activation is refused. The offending input is the draft being activated.","triggerScenarios":"Thrown at crates/codex-plus-core/src/dream_skin_library.rs:419 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restore the built-in theme to its default state before activating","Create a new custom theme instead of modifying the built-in one","Repair app state if the built-in theme data was corrupted"],"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"}