{"record":{"id":"577937a243a2ea4d","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-577937","errorCode":null,"errorMessage":"主题包必须且只能包含一个背景图片","messagePattern":"主题包必须且只能包含一个背景图片","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":158,"sourceCode":"    let manifest_bytes = files\n        .remove(\"manifest.json\")\n        .context(\"主题包缺少 manifest.json\")?;\n    let theme_bytes = files\n        .remove(\"theme.json\")\n        .context(\"主题包缺少 theme.json\")?;\n    let css_bytes = files.remove(\"theme.css\").context(\"主题包缺少 theme.css\")?;\n    let image_name = [\"background.webp\", \"background.jpg\", \"background.png\"]\n        .iter()\n        .find(|name| files.contains_key(**name))\n        .map(|name| (*name).to_string())\n        .context(\"主题包必须包含一个背景图片\")?;\n    if [\"background.webp\", \"background.jpg\", \"background.png\"]\n        .iter()\n        .filter(|name| files.contains_key(**name))\n        .count()\n        != 1\n    {\n        bail!(\"主题包必须且只能包含一个背景图片\");\n    }\n    let image_bytes = files.remove(&image_name).expect(\"image was checked above\");\n    validate_image_content(&image_name, &image_bytes)?;\n    let license_bytes = files.remove(\"LICENSE.txt\");\n    let signature = files.remove(\"manifest.sig\");\n    if let Some(signature) = signature {\n        if signature.len() > SIGNATURE_LIMIT {\n            bail!(\"manifest.sig 超过大小限制\");\n        }\n    }\n    if !files.is_empty() {\n        bail!(\"主题包包含未处理文件\");\n    }\n\n    let manifest: DreamSkinPackageManifest = parse_json(&manifest_bytes, \"manifest.json\")?;\n    validate_manifest(&manifest, platform)?;\n    let theme: Value = parse_json(&theme_bytes, \"theme.json\")?;\n    validate_theme(&theme, &manifest, &image_name)?;","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L140-L176","documentation":"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.","triggerScenarios":"validate_and_read_package finds no background image, or finds two/three of the allowed background filenames simultaneously in the archive.","commonSituations":"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.","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"],"exampleFix":"// before\ntheme.zip: background.png, background.webp\n// after\ntheme.zip: background.webp","handlingStrategy":"validation","validationCode":"let backgrounds = [\"background.webp\",\"background.jpg\",\"background.png\"]\n    .iter().filter(|n| files.contains_key(**n)).count();\nif backgrounds != 1 {\n    return Err(BackgroundCount(backgrounds));\n}","typeGuard":null,"tryCatchPattern":"match validate_and_read_package(&bytes, platform) {\n    Err(e) if e.to_string().contains(\"背景图片\") => {\n        Err(UserFacingError::MissingOrDuplicateBackground)\n    }\n    other => other,\n}","preventionTips":["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"],"tags":["validation","zip","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}