{"record":{"id":"3cd7716dd42df7c9","repo":"BigPizzaV3/CodexPlusPlus","slug":"manifest-files-3cd771","errorCode":null,"errorMessage":"manifest.files 缺少必需文件","messagePattern":"manifest\\.files 缺少必需文件","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":1137,"sourceCode":"        let expected_media_type = match file.path.as_str() {\n            \"theme.json\" => \"application/json\",\n            \"theme.css\" => \"text/css\",\n            \"background.webp\" => \"image/webp\",\n            \"background.jpg\" => \"image/jpeg\",\n            \"background.png\" => \"image/png\",\n            \"LICENSE.txt\" => \"text/plain\",\n            _ => \"\",\n        };\n        if file.media_type != expected_media_type {\n            bail!(\"manifest.files 的 mediaType 不匹配：{}\", file.path);\n        }\n        let actual = format!(\"{:x}\", Sha256::digest(bytes));\n        if file.bytes != bytes.len() || !actual.eq_ignore_ascii_case(&file.sha256) {\n            bail!(\"manifest.files 的 SHA-256 或大小不匹配：{}\", file.path);\n        }\n    }\n    if !seen.contains(\"theme.json\") || !seen.contains(\"theme.css\") || !seen.contains(image_name) {\n        bail!(\"manifest.files 缺少必需文件\");\n    }\n    if seen.contains(\"LICENSE.txt\") != license_bytes.is_some() {\n        bail!(\"manifest.files 的 LICENSE.txt 与包内容不一致\");\n    }\n    Ok(())\n}\n\nfn valid_theme_id(value: &str) -> bool {\n    let mut chars = value.chars();\n    chars.next().is_some_and(|c| c.is_ascii_alphanumeric())\n        && value\n            .chars()\n            .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || matches!(c, '-' | '.'))\n}\n\nfn valid_semver(value: &str) -> bool {\n    let parts = value.split('.').collect::<Vec<_>>();\n    parts.len() == 3","sourceCodeStart":1119,"sourceCodeEnd":1155,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L1119-L1155","documentation":"After the per-file loop, validate_manifest_files requires the package to contain at least the essential files: theme.json, theme.css, and the manifest-declared background image (image_name). If any of these paths was not seen among manifest.files entries, this error is thrown. LICENSE.txt is handled separately as optional-but-consistent.","triggerScenarios":"Calling validate_and_read_package where manifest.files omits theme.json, omits theme.css, or omits an entry whose path equals the manifest's declared background image filename — even if the file bytes exist in the package but are simply not listed.","commonSituations":"Building a manifest by hand and forgetting one entry; listing the image under a different name than the manifest's image field (e.g. bg.png vs background.png); stripping entries while pruning file size; a packaging bug skipping the CSS file.","solutions":["Add manifest.files entries for theme.json, theme.css, and the background image named by the manifest's image field","Make the image entry path exactly match the image filename declared elsewhere in the manifest","Regenerate the manifest with the packaging tool to guarantee required entries are emitted"],"exampleFix":"// before (manifest missing css entry)\n\"files\": [ { \"path\": \"theme.json\", ... }, { \"path\": \"background.webp\", ... } ]\n// after\n\"files\": [ { \"path\": \"theme.json\", \"mediaType\": \"application/json\", ... }, { \"path\": \"theme.css\", \"mediaType\": \"text/css\", ... }, { \"path\": \"background.webp\", \"mediaType\": \"image/webp\", ... } ]","handlingStrategy":"validation","validationCode":"const paths = new Set(manifest.files.map(f => f.path));\nconst required = [\"theme.json\", \"theme.css\", manifest.image];\nfor (const p of required) {\n  if (!paths.has(p)) throw new Error(`manifest.files is missing required file: ${p}`);\n}","typeGuard":"function hasRequiredFiles(manifest) {\n  const paths = new Set(manifest.files.map(f => f.path));\n  return [\"theme.json\", \"theme.css\", manifest.image].every(p => paths.has(p));\n}","tryCatchPattern":null,"preventionTips":["Check the files array against the required list (theme.json, theme.css, image) before signing","Keep the image entry path identical to the manifest's declared image filename","Use the packaging tool to emit the files array instead of hand-crafting it"],"tags":["validation","manifest","missing-file","skin-package"],"backgroundTag":"missing-required-config-field","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"}