BigPizzaV3/CodexPlusPlus · error

Dream Skin 主题包文件数量必须在 1 到 32 之间

Error message

Dream Skin 主题包文件数量必须在 1 到 32 之间

What it means

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.

Solutions

  1. Repack the theme ensuring at least one file (background image) is included
  2. Reduce file count: consolidate assets, remove unneeded files so total ≤ 32
  3. Confirm you zipped the theme directory's contents, not an empty folder
  4. Drop __MACOSX and .DS_Store noise before packaging (those are skipped, not counted toward allowed files)

Example fix

// before
zip -r theme.zip empty-dir/   # 0 entries
// after
zip -r theme.zip background.webp LICENSE.txt manifest.json
Defensive patterns

Strategy: validation

Validate before calling

let count = zip::read::ZipArchive::new(Cursor::new(&bytes))?.len();
if count == 0 || count > 32 {
    return Err(BadEntryCount(count));
}

Try / catch

match validate_and_read_package(&bytes, platform) {
    Err(e) if e.to_string().contains("文件数量") => {
        Err(UserFacingError::BadPackageStructure)
    }
    other => other,
}

Prevention

When it happens

Trigger: Passing an empty ZIP (0 entries) or a package containing more than 32 files to validate_and_read_package.

Common situations: Packaging tool produced an archive without files (e.g. wrong directory zipped), theme bundle includes many images/fonts/macos cruft beyond the limit.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/fef17ff48374a64a. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/dream_skin_package.rs:97

    pub theme: Value,
    pub image_name: String,
    pub image_bytes: Vec<u8>,
    pub css: String,
    pub manifest_bytes: Vec<u8>,
    pub license_bytes: Option<Vec<u8>>,
}

pub fn validate_and_read_package(
    bytes: &[u8],
    platform: &str,
) -> anyhow::Result<ValidatedDreamSkinPackage> {
    if bytes.is_empty() || bytes.len() > PACKAGE_LIMIT {
        bail!("Dream Skin 主题包超过 32 MiB 限制");
    }
    let mut archive =
        ZipArchive::new(Cursor::new(bytes)).context("Dream Skin 主题包不是有效 ZIP")?;
    if archive.len() == 0 || archive.len() > FILE_LIMIT {
        bail!("Dream Skin 主题包文件数量必须在 1 到 32 之间");
    }

    let mut entries = Vec::new();
    let mut unpacked = 0usize;
    for index in 0..archive.len() {
        let file = archive
            .by_index(index)
            .context("读取 Dream Skin ZIP 条目失败")?;
        let name = file.name().to_string();
        validate_archive_entry_name(&name)?;
        if file.encrypted() || file.is_symlink() {
            bail!("主题包包含加密内容或链接:{name}");
        }
        if file.is_dir() {
            entries.push((name, None));
            continue;
        }
        let base_name = name.rsplit('/').next().unwrap_or_default();

View on GitHub (pinned to b1ed92e5e4)