BigPizzaV3/CodexPlusPlus · error

theme.json.art 枚举值无效

Error message

theme.json.art 枚举值无效

What it means

Thrown by validate_theme_art when optional safeArea is not one of left/right/none or taskMode is not one of its allowed enum strings. The offending input is theme.json.art.safeArea or .taskMode — enum-valued display hints whose accepted values are fixed by the renderer.

Source

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

    for key in ["focusX", "focusY"] {
        if object.get(key).is_some_and(|value| {
            value
                .as_f64()
                .is_none_or(|number| !number.is_finite() || !(0.0..=1.0).contains(&number))
        }) {
            bail!("theme.json.art.{key} 无效");
        }
    }
    if object.get("safeArea").is_some_and(|value| {
        value
            .as_str()
            .is_none_or(|value| !matches!(value, "left" | "right" | "none"))
    }) || object.get("taskMode").is_some_and(|value| {
        value
            .as_str()
            .is_none_or(|value| !matches!(value, "ambient" | "full" | "off"))
    }) {
        bail!("theme.json.art 枚举值无效");
    }
    Ok(())
}

fn valid_theme_color(value: &str) -> bool {
    if let Some(hex) = value.strip_prefix('#') {
        return matches!(hex.len(), 3 | 4 | 6 | 8)
            && hex.bytes().all(|byte| byte.is_ascii_hexdigit());
    }
    if value.starts_with("rgb(") && value.ends_with(')') {
        let values = &value[4..value.len() - 1];
        return split_top_level(values, ',').is_some_and(|values| {
            values.len() == 3
                && values.into_iter().all(|value| {
                    let value = value.trim();
                    !value.is_empty()
                        && value.len() <= 3
                        && value.bytes().all(|byte| byte.is_ascii_digit())

View on GitHub (pinned to f2074595a2)

Solutions

  1. 把 safeArea 改为 left、right 或 none
  2. 把 taskMode 改为规范允许的枚举值
Defensive patterns

Strategy: validation

When it happens

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