BigPizzaV3/CodexPlusPlus · error

theme.css 每条规则必须至少包含一个声明

Error message

theme.css 每条规则必须至少包含一个声明

What it means

Thrown by parse_safe_css when a CSS rule block closes with zero collected declarations (e.g. 'selector { }'). Each rule must carry at least one property/value pair to be representable as a SafeCssRule; the offending input is the empty rule block just parsed in theme.css.

Source

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

                || !seen.insert(property)
            {
                bail!("theme.css CSS 属性无效或重复:{property}");
            }
            if value.is_empty()
                || value.chars().count() > 512
                || value.contains(['{', '}', '<', '>', '!', ';'])
                || !validate_property_value(property, value)
            {
                bail!("theme.css 属性值不受 Safe CSS 支持:{property}");
            }
            declarations += 1;
            if declarations > 512 {
                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 {

View on GitHub (pinned to f2074595a2)

Solutions

  1. Remove empty rule blocks
  2. Add at least one valid declaration inside each rule
Defensive patterns

Strategy: validation

When it happens

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