{"record":{"id":"94608f74872fa47b","repo":"BigPizzaV3/CodexPlusPlus","slug":"manifest-files","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":977,"sourceCode":"        || manifest.license.len() > 64\n        || !manifest.license.bytes().enumerate().all(|(index, byte)| {\n            byte.is_ascii_alphanumeric()\n                || (index > 0 && matches!(byte, b' ' | b'.' | b'+' | b'(' | b')' | b'-'))\n        })\n        || !safe_manifest_text(&manifest.provenance.summary, 1, 500, true)\n    {\n        bail!(\"manifest 发布者、许可证或来源说明为空\");\n    }\n    if manifest\n        .key_id\n        .as_deref()\n        .is_some_and(|key| !valid_key_id(key))\n        || !valid_rfc3339(&manifest.created_at)\n    {\n        bail!(\"manifest keyId 或 createdAt 无效\");\n    }\n    if manifest.files.len() < 2 || manifest.files.len() > 8 {\n        bail!(\"manifest.files 数量无效\");\n    }\n    Ok(())\n}\n\nfn validate_theme(\n    theme: &Value,\n    manifest: &DreamSkinPackageManifest,\n    image_name: &str,\n) -> anyhow::Result<()> {\n    let object = theme.as_object().context(\"theme.json 必须是对象\")?;\n    const REQUIRED: &[&str] = &[\"schemaVersion\", \"id\", \"name\", \"image\"];\n    const OPTIONAL: &[&str] = &[\n        \"brandSubtitle\",\n        \"tagline\",\n        \"projectPrefix\",\n        \"projectLabel\",\n        \"statusText\",\n        \"quote\",","sourceCodeStart":959,"sourceCodeEnd":995,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L959-L995","documentation":"validate_manifest rejects the package when manifest.files contains fewer than 2 or more than 8 entries. A valid package must bundle manifest.json, theme.json, theme.css, LICENSE.txt, an image and optionally a signature — below 2 means a truncated/empty file list, above 8 means unexpected extra files. Thrown during validate_and_read_package.","triggerScenarios":"validate_and_read_package builds the files list and finds only one entry (e.g. just manifest.json), or an archive containing 9+ files such as extra assets or nested resources.","commonSituations":"Incomplete uploads where most files were dropped; archives that accidentally include OS junk (.DS_Store, Thumbs.db) or multiple images; repackaging scripts appending extra files.","solutions":["Ensure the package contains the required files (manifest.json, theme.json, theme.css, LICENSE.txt, one background image)","Remove extra/non-whitelisted files so the total is at most 8","Check the archive was fully uploaded/extracted and is not truncated","List the archive contents and diff against the allowed file set before repacking"],"exampleFix":"// before: archive with 9 files incl. .DS_Store\n// after: repack without .DS_Store, keeping manifest.json, theme.json, theme.css, LICENSE.txt, background.png (+ manifest.sig)","handlingStrategy":"validation","validationCode":"let count = manifest.files.len();\nif !(2..=8).contains(&count) {\n    // inspect and repack the archive before calling validate_and_read_package\n}\nconst ALLOWED: [&str; 6] = [\"manifest.json\",\"theme.json\",\"theme.css\",\"LICENSE.txt\",\"manifest.sig\",\"background.png\"];\nlet extras: Vec<_> = manifest.files.iter().filter(|f| !ALLOWED.contains(&f.as_str())).collect();","typeGuard":"fn file_count_ok(files: &[String]) -> bool {\n    (2..=8).contains(&files.len())\n}","tryCatchPattern":"match validate_and_read_package(&path, platform) {\n    Err(e) if e.to_string().contains(\"files 数量无效\") => {\n        eprintln!(\"package rejected: manifest.files has {} entries (need 2-8)\", manifest.files.len());\n    }\n    other => other?,\n}","preventionTips":["Count files with zip/tar -l before distributing an archive","Exclude OS junk (.DS_Store, Thumbs.db) in packaging scripts","Verify the upload completed and the archive extracts fully"],"tags":["manifest","package-structure","validation"],"backgroundTag":"value-out-of-range","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"}