BigPizzaV3/CodexPlusPlus · error

theme.css 必须至少包含一条规则

Error message

theme.css 必须至少包含一条规则

What it means

Thrown by parse_safe_css at the end of parsing when no rule was successfully collected — the entire theme.css produced an empty parsed list even though it passed the earlier non-empty byte check (e.g. it contained only garbage that never formed a rule). The offending input is the overall theme.css content; the package is rejected because a skin must define at least one style rule.

Source

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

                bail!("theme.css 声明数量超过限制");
            }
            rule_declarations.push((property, value));
        }
        if rule_declarations.is_empty() {
            bail!("theme.css 每条规则必须至少包含一个声明");
        }
        parsed.push(SafeCssRule {
            selector,
            part,
            declarations: rule_declarations,
        });
        if parsed.len() > 128 {
            bail!("theme.css 规则数量超过限制");
        }
        rest = &rest[close + 1..];
    }
    if parsed.is_empty() {
        bail!("theme.css 必须至少包含一条规则");
    }
    Ok(parsed)
}

fn forbidden_css_character(character: char) -> bool {
    matches!(
        character as u32,
        0x0000..=0x0008 | 0x000b | 0x000e..=0x001f | 0x007f..=0x009f
            | 0x2028 | 0x2029 | 0x200e | 0x200f | 0x202a..=0x202e | 0x2066..=0x2069 | 0xfeff
    )
}

fn validate_property_value(property: &str, value: &str) -> bool {
    const COLOR_PROPERTIES: &[&str] = &[
        "color",
        "background-color",
        "border-color",
        "border-top-color",

View on GitHub (pinned to f2074595a2)

Solutions

  1. Add at least one valid [data-ds-part] rule to theme.css
  2. Verify the stylesheet is not empty or only whitespace
Defensive patterns

Strategy: validation

When it happens

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