BigPizzaV3/CodexPlusPlus · error
theme.json 与 manifest 身份或背景图不一致
Error message
theme.json 与 manifest 身份或背景图不一致
What it means
validate_theme rejects a theme.json whose identity fields do not agree with the package manifest and the bundled image. The library requires schemaVersion==1, theme.json id equal to manifest.theme_id, a string name, and an image field exactly matching the background image filename declared in the manifest. This cross-file consistency check prevents packages that claim one identity in manifest.json but ship a different one in theme.json.
Solutions
- Set theme.json schemaVersion to the number 1 (not the string "1")
- Make theme.json.id exactly equal to manifest.json's themeId field
- Set theme.json.image to the exact background image filename (e.g. "background.webp") used in manifest.files
- Ensure theme.json.name is a plain string value
- Regenerate both manifest.json and theme.json together with the packaging tool instead of editing one
Example fix
// before (theme.json)
{ "schemaVersion": "1", "id": "old-theme", "image": "background.png", ... }
// after
{ "schemaVersion": 1, "id": "my-theme", "name": "My Theme", "image": "background.webp", ... } Defensive patterns
Strategy: validation
Validate before calling
const t = JSON.parse(themeJson);
const m = JSON.parse(manifestJson);
if (t.schemaVersion !== 1) throw new Error("schemaVersion must be number 1");
if (t.id !== m.themeId) throw new Error("theme.json id != manifest themeId");
if (typeof t.name !== "string") throw new Error("name must be string");
if (t.image !== m.image) throw new Error("theme.json image != manifest image"); Type guard
function hasConsistentIdentity(t, m) {
return typeof t === "object" && t !== null &&
t.schemaVersion === 1 && t.id === m.themeId &&
typeof t.name === "string" && t.image === m.image;
} Prevention
- Always generate theme.json and manifest.json together from one source of truth
- Keep themeId and image filename in shared constants used by both files
- Never hand-edit one of the two files in isolation
- Write schemaVersion as a JSON number
When it happens
Trigger: Calling validate_and_read_package on a skin package where theme.json has schemaVersion != 1 (or non-numeric), theme.json.id differs from manifest.theme_id, theme.json.name is not a string, or theme.json.image differs from the manifest's background image filename.
Common situations: Hand-editing theme.json and renaming the background file only in one file; regenerating a manifest with a new theme_id while reusing an old theme.json; writing schemaVersion as a string "1" instead of the number 1; pointing image at a different resolution file than the one listed in manifest.files.
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/9620df49a2a212d2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1015
"promoSub",
"promoUrl",
"appearance",
"art",
"colors",
];
if REQUIRED.iter().any(|key| !object.contains_key(*key))
|| object
.keys()
.any(|key| !REQUIRED.contains(&key.as_str()) && !OPTIONAL.contains(&key.as_str()))
{
bail!("theme.json 包含缺失或不支持的字段");
}
if object.get("schemaVersion").and_then(Value::as_u64) != Some(1)
|| object.get("id").and_then(Value::as_str) != Some(manifest.theme_id.as_str())
|| object.get("name").and_then(Value::as_str).is_none()
|| object.get("image").and_then(Value::as_str) != Some(image_name)
{
bail!("theme.json 与 manifest 身份或背景图不一致");
}
if object
.get("name")
.and_then(Value::as_str)
.is_some_and(|name| !safe_manifest_text(name, 1, 80, false))
{
bail!("theme.json.name 无效");
}
for key in [
"brandSubtitle",
"tagline",
"projectPrefix",
"projectLabel",
"statusText",
"quote",
"promoTitle",
"promoSub",
] {View on GitHub (pinned to b1ed92e5e4)