{"record":{"id":"fef17ff48374a64a","repo":"BigPizzaV3/CodexPlusPlus","slug":"dream-skin-1-32","errorCode":null,"errorMessage":"Dream Skin 主题包文件数量必须在 1 到 32 之间","messagePattern":"Dream Skin 主题包文件数量必须在 1 到 32 之间","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":97,"sourceCode":"    pub theme: Value,\n    pub image_name: String,\n    pub image_bytes: Vec<u8>,\n    pub css: String,\n    pub manifest_bytes: Vec<u8>,\n    pub license_bytes: Option<Vec<u8>>,\n}\n\npub fn validate_and_read_package(\n    bytes: &[u8],\n    platform: &str,\n) -> anyhow::Result<ValidatedDreamSkinPackage> {\n    if bytes.is_empty() || bytes.len() > PACKAGE_LIMIT {\n        bail!(\"Dream Skin 主题包超过 32 MiB 限制\");\n    }\n    let mut archive =\n        ZipArchive::new(Cursor::new(bytes)).context(\"Dream Skin 主题包不是有效 ZIP\")?;\n    if archive.len() == 0 || archive.len() > FILE_LIMIT {\n        bail!(\"Dream Skin 主题包文件数量必须在 1 到 32 之间\");\n    }\n\n    let mut entries = Vec::new();\n    let mut unpacked = 0usize;\n    for index in 0..archive.len() {\n        let file = archive\n            .by_index(index)\n            .context(\"读取 Dream Skin ZIP 条目失败\")?;\n        let name = file.name().to_string();\n        validate_archive_entry_name(&name)?;\n        if file.encrypted() || file.is_symlink() {\n            bail!(\"主题包包含加密内容或链接：{name}\");\n        }\n        if file.is_dir() {\n            entries.push((name, None));\n            continue;\n        }\n        let base_name = name.rsplit('/').next().unwrap_or_default();","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L79-L115","documentation":"After the ZIP parses, validate_and_read_package checks the entry count is between 1 (FILE_LIMIT lower bound) and 32. A zero-entry archive has no content; more than 32 entries is rejected to bound processing cost. Throws before reading any entry contents.","triggerScenarios":"Passing an empty ZIP (0 entries) or a package containing more than 32 files to validate_and_read_package.","commonSituations":"Packaging tool produced an archive without files (e.g. wrong directory zipped), theme bundle includes many images/fonts/macos cruft beyond the limit.","solutions":["Repack the theme ensuring at least one file (background image) is included","Reduce file count: consolidate assets, remove unneeded files so total ≤ 32","Confirm you zipped the theme directory's contents, not an empty folder","Drop __MACOSX and .DS_Store noise before packaging (those are skipped, not counted toward allowed files)"],"exampleFix":"// before\nzip -r theme.zip empty-dir/   # 0 entries\n// after\nzip -r theme.zip background.webp LICENSE.txt manifest.json","handlingStrategy":"validation","validationCode":"let count = zip::read::ZipArchive::new(Cursor::new(&bytes))?.len();\nif count == 0 || count > 32 {\n    return Err(BadEntryCount(count));\n}","typeGuard":null,"tryCatchPattern":"match validate_and_read_package(&bytes, platform) {\n    Err(e) if e.to_string().contains(\"文件数量\") => {\n        Err(UserFacingError::BadPackageStructure)\n    }\n    other => other,\n}","preventionTips":["Inspect package with `unzip -l` before shipping; ensure 1–32 files","Verify the zip was created from a non-empty directory","Add a packaging CI check that counts entries before publishing"],"tags":["validation","zip","size-limit"],"backgroundTag":"payload-too-large","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"}