BigPizzaV3/CodexPlusPlus · error

theme.css 为空或超过 256 KiB 限制

Error message

theme.css 为空或超过 256 KiB 限制

What it means

Thrown by parse_safe_css when the theme.css payload is empty or larger than CSS_LIMIT (256 KiB). parse_safe_css is the strict Safe CSS pre-parser for Dream Skin packages, so this fires before any rule parsing happens — a coarse size/emptiness gate on the raw css string extracted from the package. The offending input is the theme.css content itself.

Source

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

            compiled.push_str(rule.selector);
            compiled.push_str(" :where(button:not([class~=\"bg-token-foreground\"]), button:not([class~=\"bg-token-foreground\"]) *) {\n");
            compiled.push_str(&format!("    color: {value} !important;\n  }}\n"));
        }
    }
    compiled.push_str("}\n");
    Ok(compiled)
}

#[derive(Debug)]
struct SafeCssRule<'a> {
    selector: &'a str,
    part: &'a str,
    declarations: Vec<(&'a str, &'a str)>,
}

fn parse_safe_css(css: &str) -> anyhow::Result<Vec<SafeCssRule<'_>>> {
    if css.is_empty() || css.len() > CSS_LIMIT {
        bail!("theme.css 为空或超过 256 KiB 限制");
    }
    if css.chars().any(forbidden_css_character)
        || css.contains("/*")
        || css.contains("*/")
        || css.contains('\\')
    {
        bail!("theme.css 包含不允许的控制字符、注释或转义");
    }
    let allowed_parts = [
        "root",
        "sidebar",
        "main",
        "header",
        "home",
        "home-hero",
        "project-list",
        "thread",
        "message",

View on GitHub (pinned to f2074595a2)

Solutions

  1. Provide a non-empty theme.css with at least one rule
  2. Reduce the stylesheet to under 256 KiB
Defensive patterns

Strategy: validation

When it happens

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