BigPizzaV3/CodexPlusPlus · error
theme.json. 无效
Error message
theme.json.{key} 无效 What it means
validate_theme checks each optional text field (brandSubtitle, tagline, projectPrefix, projectLabel, statusText, quote, promoTitle, promoSub) of theme.json. If a field is present but is not a string, or its string fails safe_manifest_text(text, 0, 120, false) (over 120 chars or unsafe characters), the library bails with the offending key in the message.
Solutions
- Make the offending field a plain string (check the key named in the message)
- Shorten the string to 120 characters or fewer
- Remove control characters, newlines, and other unsafe content
- Omit the field entirely if not needed — all eight keys are optional
Example fix
// before "tagline": 42 // after "tagline": "Ship faster with a dark theme"
Defensive patterns
Strategy: validation
Validate before calling
const TEXT_KEYS = ["brandSubtitle","tagline","projectPrefix","projectLabel","statusText","quote","promoTitle","promoSub"];
for (const k of TEXT_KEYS) {
if (k in theme && (typeof theme[k] !== "string" || theme[k].length > 120 || /[\u0000-\u001f]/.test(theme[k]))) {
throw new Error(`theme.json.${k} must be a safe string of at most 120 chars`);
}
} Type guard
function isValidOptionalText(v) {
return typeof v === "string" && v.length <= 120 && !/[\u0000-\u001f]/.test(v);
} Prevention
- Omit optional text fields you do not need instead of writing empty/placeholder values
- Enforce a 120-char limit in your theme authoring UI
- Sanitize pasted marketing copy (newlines, control chars) before insertion
When it happens
Trigger: Calling validate_and_read_package with a theme.json where any of the eight optional text keys is present as a non-string (number, null is absent-safe, object) or as a string longer than 120 chars / containing unsafe characters.
Common situations: Putting a number or boolean in projectPrefix; pasting a tagline over 120 characters; embedding newlines or control characters in statusText or quote; using localized text with forbidden characters.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- theme.json.name 无效
- theme.json 的链接或外观字段无效
- theme.json.colors 字段无效
- theme.json.colors 缺少
- theme.json 与 manifest 身份或背景图不一致
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/92b976b8289ef4d8.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1039
{
bail!("theme.json.name 无效");
}
for key in [
"brandSubtitle",
"tagline",
"projectPrefix",
"projectLabel",
"statusText",
"quote",
"promoTitle",
"promoSub",
] {
if object.get(key).is_some_and(|value| {
value
.as_str()
.is_none_or(|text| !safe_manifest_text(text, 0, 120, false))
}) {
bail!("theme.json.{key} 无效");
}
}
if object.get("promoUrl").is_some_and(|value| {
value
.as_str()
.is_none_or(|text| !safe_manifest_text(text, 0, 512, false))
}) || object.get("appearance").is_some_and(|value| {
value
.as_str()
.is_none_or(|appearance| !matches!(appearance, "auto" | "light" | "dark"))
}) {
bail!("theme.json 的链接或外观字段无效");
}
if let Some(art) = object.get("art") {
validate_theme_art(art)?;
}
if let Some(colors) = object.get("colors") {
let colors = colors.as_object().context("theme.json.colors 必须是对象")?;View on GitHub (pinned to b1ed92e5e4)