BigPizzaV3/CodexPlusPlus · error

invalid Dream Skin style preset

Error message

invalid Dream Skin style preset

What it means

validate_theme_draft optionally checks draft.config.style_preset: if the field is non-empty it must itself pass valid_theme_id (1-64 bytes, alphanumeric start, [a-z0-9._-] only). The preset is the identifier of a base style the theme builds on, so a malformed preset id is rejected before saving. An empty string means 'no preset' and is allowed.

Solutions

  1. Set style_preset to a valid slug id (lowercase [a-z0-9._-], <=64 bytes) of an existing preset, or leave it empty ("") for no preset.
  2. Slugify the value the same way as theme ids before assigning it.
  3. Verify the referenced preset actually exists in the library to avoid a saved theme pointing at a nonexistent style.

Example fix

// before
config.style_preset = "Midnight Blue".into(); // invalid: uppercase + space
save_dream_skin_theme(&state_dir, &draft(config))?;
// after
config.style_preset = "midnight".into(); // valid preset id, or "" for none
save_dream_skin_theme(&state_dir, &draft(config))?;
Defensive patterns

Strategy: validation

Validate before calling

if !draft.config.style_preset.is_empty() && !is_valid_theme_id(&draft.config.style_preset) {
    draft.config.style_preset.clear(); // or fix to a known preset slug
}

Type guard

fn has_valid_preset(c: &DreamSkinThemeConfig) -> bool {
    c.style_preset.is_empty() || is_valid_theme_id(&c.style_preset)
}

Prevention

When it happens

Trigger: Saving a draft whose style_preset is non-empty but malformed — uppercase ("Midnight"), spaces, >64 chars, leading '-', or containing '/' — while empty string passes fine.

Common situations: Typing a preset's display name instead of its slug id; importing packages whose preset references a foreign naming convention; a preset id referencing a theme that was renamed or removed, then re-saved after hand-editing.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/94c66d7f5c0bae93. Report an issue: GitHub.

Appendix: source

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

    }
    remove_known_theme_directory(&directory)
}

fn validate_theme_draft(draft: &DreamSkinThemeDraft) -> anyhow::Result<()> {
    if draft.builtin {
        bail!("built-in Dream Skin theme is read-only");
    }
    if !valid_theme_id(&draft.config.id) {
        bail!("invalid Dream Skin theme id");
    }
    if draft.config.schema_version != 1 {
        bail!("unsupported Dream Skin theme schema");
    }
    if draft.config.name.trim().is_empty() {
        bail!("Dream Skin theme name is empty");
    }
    if !draft.config.style_preset.is_empty() && !valid_theme_id(&draft.config.style_preset) {
        bail!("invalid Dream Skin style preset");
    }
    if let Some(colors) = &draft.config.colors {
        for color in [
            &colors.background,
            &colors.panel,
            &colors.panel_alt,
            &colors.accent,
            &colors.accent_alt,
            &colors.secondary,
            &colors.highlight,
            &colors.text,
            &colors.muted,
            &colors.line,
        ] {
            if !valid_css_color(color) {
                bail!("invalid Dream Skin theme color: {color}");
            }
        }

View on GitHub (pinned to b1ed92e5e4)