BigPizzaV3/CodexPlusPlus · error
theme.css 只能选择 Skin API 注册的 data-ds-part
Error message
theme.css 只能选择 Skin API 注册的 data-ds-part
What it means
Selector whitelist guard in parse_safe_css: the selector does not begin with the literal prefix [data-ds-part=". The Safe CSS engine only styles elements registered through the Skin API via data-ds-part attributes; arbitrary selectors (tag, class, id) are refused.
Source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:329
let open = rest.find('{').context("theme.css 规则缺少开始括号")?;
let selector = rest[..open].trim();
if selector.is_empty()
|| selector.contains([',', '@', ';', '}'])
|| rest[open + 1..].find('{').is_some_and(|nested| {
rest[open + 1..]
.find('}')
.is_none_or(|close| nested < close)
})
{
bail!("theme.css 选择器或规则语法无效");
}
let close = open
+ 1
+ rest[open + 1..]
.find('}')
.context("theme.css 规则缺少结束括号")?;
let Some(after_prefix) = selector.strip_prefix("[data-ds-part=\"") else {
bail!("theme.css 只能选择 Skin API 注册的 data-ds-part");
};
let (part, suffix) = after_prefix
.split_once("\"]")
.context("theme.css data-ds-part 语法无效")?;
if !allowed_parts.contains(&part)
|| (!suffix.is_empty() && suffix != ":hover" && suffix != ":focus-visible")
{
bail!("theme.css 使用了未注册的 Skin API part 或状态");
}
let mut rule_declarations = Vec::new();
let mut seen = HashSet::new();
for declaration in rest[open + 1..close]
.split(';')
.map(str::trim)
.filter(|value| !value.is_empty())
{
let (property, value) = declarationView on GitHub (pinned to f2074595a2)
Solutions
- Rewrite selectors as [data-ds-part="<registered part>"]
- Style only Skin API registered parts
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/codex-plus-core/src/dream_skin_package.rs:329 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/529277afd2b4f7b4.
Report an issue: GitHub.