BigPizzaV3/CodexPlusPlus · error
theme.json.art. 无效
Error message
theme.json.art.{key} 无效 What it means
validate_theme_art validates the numeric fields focusX and focusY inside theme.json.art. Both must parse as finite f64 values within the inclusive range 0.0..=1.0 (normalized focal-point coordinates). The library throws "theme.json.art.{key} 无效" when either key is present but its value is not a finite number in [0,1].
Solutions
- Open theme.json and locate art.focusX / art.focusY.
- Convert pixel or percentage coordinates to normalized values: value = pixel / imageDimension (or percent / 100).
- Ensure the value is an unquoted JSON number between 0.0 and 1.0 inclusive.
- Remove quotes around the number if it is a string, and remove null/objects from these keys.
- Re-validate the package to confirm.
Example fix
// before: pixel coordinate and quoted value
{ "art": { "focusX": "0.75", "focusY": 512 } }
// after: normalized numbers in [0,1]
{ "art": { "focusX": 0.75, "focusY": 0.5 } } Defensive patterns
Strategy: validation
Validate before calling
fn focus_valid(v: Option<&Value>) -> bool {
v.map(|v| v.as_f64().map_or(false, |n| n.is_finite() && (0.0..=1.0).contains(&n))).unwrap_or(true)
}
// art.focusX/focusY must pass focus_valid Type guard
fn is_unit_f64(v: &Value) -> bool {
v.as_f64().map_or(false, |n| n.is_finite() && (0.0..=1.0).contains(&n))
} Try / catch
match validate_theme(value) {
Err(e) if e.to_string().contains("art.focus") => eprintln!("focusX/focusY must be finite numbers in [0,1]: {e}"),
other => other?,
} Prevention
- Always export focus points as normalized 0-1 values, not pixels or percentages.
- Never quote focusX/focusY values in JSON.
- Add a linter on theme.json that checks numeric ranges before packaging.
When it happens
Trigger: Calling validate_theme where theme.json.art.focusX or theme.json.art.focusY is: a string ("0.5"), null, boolean, an object/array, NaN/infinite after parsing, or a number outside [0.0, 1.0] such as 1.5 or -0.1.
Common situations: Authors writing pixel coordinates (e.g. 512) instead of normalized 0-1 values; exporting focus points from design tools as percentages (50 instead of 0.5); quoting the number in JSON; negative or >1 values from manual editing.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- theme.json.art 包含不支持的字段
- theme.json.art 枚举值无效
- manifest.files 缺少必需文件
- manifest.files 包含无效条目
- manifest.files 的 LICENSE.txt 与包内容不一致
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/e25c787ffdcdb727.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1294
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"))
}) {
bail!("theme.json.art 枚举值无效");
}
Ok(())
}
fn valid_theme_color(value: &str) -> bool {
if let Some(hex) = value.strip_prefix('#') {View on GitHub (pinned to b1ed92e5e4)