BigPizzaV3/CodexPlusPlus · error

invalid Dream Skin theme config

Error message

invalid Dream Skin theme config

What it means

load_stored_dream_skin_theme validates the theme's config file (theme.json): it must be a regular file, not a symlink, and its size must not exceed THEME_CONFIG_LIMIT (256 KiB). Any violation bails with "invalid Dream Skin theme config", keeping stored themes within safe, parseable bounds.

Solutions

  1. Shrink theme.json below 256 KiB (remove embedded blobs, minify) or regenerate the theme via the library API
  2. Replace any symlinked config with a real file at themes/<id>/theme.json
  3. Delete the broken theme and re-create it with create_dream_skin_theme_from_image
  4. Check disk/file for corruption (`wc -c` the file) to confirm which invariant failed

Example fix

// before
// themes/my-theme/theme.json is a symlink or 300 KiB
// after
rm themes/my-theme/theme.json   # drop symlink/oversized file
# recreate the theme through the library so a valid config is written
Defensive patterns

Strategy: validation

Validate before calling

let path = state_dir.join("themes").join(id).join("theme.json");
let md = std::fs::symlink_metadata(&path)?;
if !md.file_type().is_file() || md.file_type().is_symlink() || md.len() > THEME_CONFIG_LIMIT {
    return Err(anyhow::anyhow!("theme.json for '{id}' is not a plain file under 256 KiB"));
}

Type guard

fn is_safe_theme_config(path: &std::path::Path) -> bool {
    match std::fs::symlink_metadata(path) {
        Ok(md) => md.file_type().is_file() && !md.file_type().is_symlink() && md.len() <= THEME_CONFIG_LIMIT,
        Err(_) => false,
    }
}

Try / catch

match load_stored_dream_skin_theme(&state_dir, &id) {
    Ok(draft) => use(draft),
    Err(e) if e.to_string().contains("invalid Dream Skin theme config") => eprintln!("theme.json for {id} is oversized or not a regular file; recreate the theme"),
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: The stored theme's config file is a symlink, is a directory or other non-file, or exceeds 256 KiB on disk when loading a theme via any of the public entry points (load, save with existing id, rename, delete, create-from-image).

Common situations: An oversized config was written by an older/broken version or hand-edited; a dotfile manager replaced the config with a symlink; restore tooling left a corrupted entry where theme.json should be.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

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

    id: &str,
) -> anyhow::Result<DreamSkinThemeDraft> {
    if !valid_theme_id(id) {
        bail!("invalid Dream Skin theme id");
    }
    let directory = state_dir.join(THEMES_DIR).join(id);
    let metadata = std::fs::symlink_metadata(&directory)
        .with_context(|| format!("Dream Skin theme not found: {id}"))?;
    if !metadata.file_type().is_dir() || metadata.file_type().is_symlink() {
        bail!("Dream Skin theme path is not a safe directory");
    }
    let config_path = directory.join(THEME_CONFIG_FILE);
    let metadata = std::fs::symlink_metadata(&config_path)
        .with_context(|| format!("Dream Skin theme config not found: {id}"))?;
    if !metadata.file_type().is_file()
        || metadata.file_type().is_symlink()
        || metadata.len() > THEME_CONFIG_LIMIT
    {
        bail!("invalid Dream Skin theme config");
    }
    let config: DreamSkinThemeConfig = serde_json::from_slice(&std::fs::read(&config_path)?)?;
    if config.id != id {
        bail!("Dream Skin theme id does not match directory");
    }
    let image = find_theme_image(&directory)
        .ok_or_else(|| anyhow::anyhow!("Dream Skin theme must contain exactly one image"))?;
    let draft = DreamSkinThemeDraft {
        config,
        image_path: image.to_string_lossy().into_owned(),
        builtin: false,
    };
    validate_theme_draft(&draft)?;
    Ok(draft)
}

pub fn rename_dream_skin_theme(
    state_dir: &Path,

View on GitHub (pinned to b1ed92e5e4)