BigPizzaV3/CodexPlusPlus · error
theme.json.art 包含不支持的字段
Error message
theme.json.art 包含不支持的字段
What it means
validate_theme_art whitelists the only fields permitted inside theme.json.art: focusX, focusY, safeArea, and taskMode. The library throws this error when the art object contains any other key. It exists to reject unknown/misspelled art properties early instead of silently ignoring them at render time.
Solutions
- Open theme.json and list the keys inside the art object.
- Remove any key that is not exactly focusX, focusY, safeArea, or taskMode.
- Fix misspellings of allowed keys (e.g. focusx -> focusX, key is case-sensitive).
- Check the skin spec version; migrate any fields from a newer spec that this build does not support.
- Re-run validate_theme / package validation to confirm.
Example fix
// before
{ "art": { "focusX": 0.5, "focusx": 0.5, "blur": 2 } }
// after
{ "art": { "focusX": 0.5, "focusY": 0.5 } } Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED_ART_KEYS: &[&str] = &["focusX", "focusY", "safeArea", "taskMode"];
fn art_keys_valid(art: &serde_json::Map<String, Value>) -> bool {
art.keys().all(|k| ALLOWED_ART_KEYS.contains(&k.as_str()))
} Type guard
fn is_known_art_key(key: &str) -> bool {
matches!(key, "focusX" | "focusY" | "safeArea" | "taskMode")
} Try / catch
match validate_theme(value) {
Err(e) if e.to_string().contains("不支持的字段") => eprintln!("theme.json.art has unknown keys: {e}"),
other => other?,
} Prevention
- Validate theme.json against the art schema at authoring time, not package time.
- Use typed structs (serde) with deny_unknown_fields when generating theme.json.
- Copy only documented art fields between packages; check spec version.
When it happens
Trigger: Calling validate_theme on a skin package whose theme.json has theme.json.art containing a key outside {focusX, focusY, safeArea, taskMode}, e.g. "focus_x", "blur", or "zoom".
Common situations: Typos in allowed keys (focusX written as focusx or focusX1); copying art fields from a newer/older skin spec that supports extra options; hand-authoring theme.json and guessing field names.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/cb8b9ba2836685aa.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1286
rest = &fraction[digits..];
}
if rest == "Z" {
return true;
}
if rest.len() != 6 || !matches!(rest.as_bytes()[0], b'+' | b'-') || rest.as_bytes()[3] != b':' {
return false;
}
rest[1..3].parse::<u32>().is_ok_and(|hour| hour <= 23)
&& rest[4..6].parse::<u32>().is_ok_and(|minute| minute <= 59)
}
fn validate_theme_art(value: &Value) -> anyhow::Result<()> {
let object = value.as_object().context("theme.json.art 必须是对象")?;
if object
.keys()
.any(|key| !matches!(key.as_str(), "focusX" | "focusY" | "safeArea" | "taskMode"))
{
bail!("theme.json.art 包含不支持的字段");
}
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"))View on GitHub (pinned to b1ed92e5e4)