BigPizzaV3/CodexPlusPlus · error · anyhow::Error

invalid built-in Dream Skin theme draft

Error message

invalid built-in Dream Skin theme draft

What it means

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.

Source

Thrown at crates/codex-plus-core/src/dream_skin_library.rs:419

}

pub fn rename_dream_skin_theme(
    state_dir: &Path,
    id: &str,
    name: &str,
) -> anyhow::Result<DreamSkinThemeSummary> {
    let mut draft = load_stored_dream_skin_theme(state_dir, id)?;
    draft.config.name = name.trim().to_string();
    save_dream_skin_theme(state_dir, &draft)
}

pub fn prepare_dream_skin_activation(
    state_dir: &Path,
    draft: &DreamSkinThemeDraft,
) -> anyhow::Result<DreamSkinActivation> {
    if draft.builtin {
        if draft.config != DreamSkinThemeConfig::default() || !draft.image_path.trim().is_empty() {
            bail!("invalid built-in Dream Skin theme draft");
        }
        crate::dream_skin::clear_managed_dream_skin_image(state_dir)?;
        return Ok(DreamSkinActivation {
            config: draft.config.clone(),
            active_image_path: String::new(),
        });
    }
    validate_theme_draft(draft)?;
    let managed_dir = state_dir.join("dream-skin/theme");
    let source = Path::new(draft.image_path.trim());
    let active_image = if let Some(extension) = stored_theme_image_extension(state_dir, source) {
        std::fs::create_dir_all(&managed_dir)
            .with_context(|| format!("failed to create {}", managed_dir.display()))?;
        let destination = managed_dir.join(format!("current.{extension}"));
        let bytes = std::fs::read(source)
            .with_context(|| format!("failed to read Dream Skin image {}", source.display()))?;
        crate::settings::atomic_write(&destination, &bytes).with_context(|| {
            format!("failed to store Dream Skin image {}", destination.display())

View on GitHub (pinned to f2074595a2)

Solutions

  1. Restore the built-in theme to its default state before activating
  2. Create a new custom theme instead of modifying the built-in one
  3. Repair app state if the built-in theme data was corrupted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_library.rs:419 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/981a5be358fad1a3. Report an issue: GitHub.