BigPizzaV3/CodexPlusPlus · error
主题包必须且只能包含一个背景图片
Error message
主题包必须且只能包含一个背景图片
What it means
After normalization, the package must contain exactly one background image among background.webp, background.jpg, background.png. If zero or more than one of these keys is present, the package is rejected. The image is then removed from the map and its content validated separately.
Solutions
- Include exactly one background image, named exactly background.webp, background.jpg, or background.png
- Remove duplicate background variants, keeping one format (webp preferred)
- If no background present, add one and repack
- Verify the filename spelling/case matches the allowed keys exactly
Example fix
// before theme.zip: background.png, background.webp // after theme.zip: background.webp
Defensive patterns
Strategy: validation
Validate before calling
let backgrounds = ["background.webp","background.jpg","background.png"]
.iter().filter(|n| files.contains_key(**n)).count();
if backgrounds != 1 {
return Err(BackgroundCount(backgrounds));
} Try / catch
match validate_and_read_package(&bytes, platform) {
Err(e) if e.to_string().contains("背景图片") => {
Err(UserFacingError::MissingOrDuplicateBackground)
}
other => other,
} Prevention
- Always package exactly one background image with the exact allowed filename
- Don't include multiple format variants — pick webp or jpg/png
- Validate package structure in your build pipeline before publishing
When it happens
Trigger: validate_and_read_package finds no background image, or finds two/three of the allowed background filenames simultaneously in the archive.
Common situations: Author included both background.png and background.webp for fallback; forgot to include any background; case-mismatched name (Background.PNG) means the real one is missing and a disallowed-file error usually fires first.
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
- 主题包必须是 32 MiB 以内的普通 ZIP 文件
- 本批节点描述过长或无效
- Dream Skin 主题包为空
- Dream Skin 主题包文件数量必须在 1 到 32 之间
- Dream Skin 主题包超过 32 MiB 限制
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/577937a243a2ea4d.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:158
let manifest_bytes = files
.remove("manifest.json")
.context("主题包缺少 manifest.json")?;
let theme_bytes = files
.remove("theme.json")
.context("主题包缺少 theme.json")?;
let css_bytes = files.remove("theme.css").context("主题包缺少 theme.css")?;
let image_name = ["background.webp", "background.jpg", "background.png"]
.iter()
.find(|name| files.contains_key(**name))
.map(|name| (*name).to_string())
.context("主题包必须包含一个背景图片")?;
if ["background.webp", "background.jpg", "background.png"]
.iter()
.filter(|name| files.contains_key(**name))
.count()
!= 1
{
bail!("主题包必须且只能包含一个背景图片");
}
let image_bytes = files.remove(&image_name).expect("image was checked above");
validate_image_content(&image_name, &image_bytes)?;
let license_bytes = files.remove("LICENSE.txt");
let signature = files.remove("manifest.sig");
if let Some(signature) = signature {
if signature.len() > SIGNATURE_LIMIT {
bail!("manifest.sig 超过大小限制");
}
}
if !files.is_empty() {
bail!("主题包包含未处理文件");
}
let manifest: DreamSkinPackageManifest = parse_json(&manifest_bytes, "manifest.json")?;
validate_manifest(&manifest, platform)?;
let theme: Value = parse_json(&theme_bytes, "theme.json")?;
validate_theme(&theme, &manifest, &image_name)?;View on GitHub (pinned to b1ed92e5e4)