BigPizzaV3/CodexPlusPlus · error

theme.json.colors 字段无效

Error message

theme.json.colors 字段无效

What it means

Thrown by validate_theme when the optional theme.json.colors object does not have exactly the 10 expected keys (background, panel, panelAlt, accent, accentAlt, secondary, highlight, text, muted, line). The offending input is the colors object's key set — both missing keys and extra keys trip this because count != 10; per-key value validation happens in the loop after.

Source

Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1071

    if let Some(art) = object.get("art") {
        validate_theme_art(art)?;
    }
    if let Some(colors) = object.get("colors") {
        let colors = colors.as_object().context("theme.json.colors 必须是对象")?;
        let keys = [
            "background",
            "panel",
            "panelAlt",
            "accent",
            "accentAlt",
            "secondary",
            "highlight",
            "text",
            "muted",
            "line",
        ];
        if colors.len() != keys.len() {
            bail!("theme.json.colors 字段无效");
        }
        for key in keys {
            if colors
                .get(key)
                .and_then(Value::as_str)
                .is_none_or(|value| !valid_theme_color(value))
            {
                bail!("theme.json.colors 缺少 {key}");
            }
        }
    }
    Ok(())
}

fn validate_manifest_files(
    manifest: &DreamSkinPackageManifest,
    manifest_bytes: &[u8],
    theme_bytes: &[u8],

View on GitHub (pinned to f2074595a2)

Solutions

  1. 让 colors 恰好包含规范的 10 个颜色键
  2. 删除多余或拼错的键
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1071 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/b8c929a8f8e61ddb. Report an issue: GitHub.