BigPizzaV3/CodexPlusPlus · error

主题包文件 超过大小限制

Error message

主题包文件 {name} 超过大小限制

What it means

Each allowed file is read with a per-file limit from file_limit(base_name); if the content is empty or exceeds that per-entry limit, this error names the offending file. Note the same message covers the empty-content case, so an empty allowed file also triggers it.

Solutions

  1. Shrink the offending file (compress the image, minify css) to fit its per-file limit
  2. Ensure every included file is non-empty — regenerate or re-download it
  3. Check which per-file limit applies via file_limit(base_name) and compare with actual size
  4. Re-export the asset at lower resolution/quality

Example fix

// before: background.png = 20 MiB (limit smaller)
// after
convert background.png -quality 80 background.webp  # under limit
Defensive patterns

Strategy: validation

Validate before calling

let limit = file_limit(base_name);
if content.is_empty() {
    return Err(EmptyFile(name.to_string()));
}
if content.len() > limit {
    return Err(FileTooLarge(name.to_string(), content.len(), limit));
}

Try / catch

match validate_and_read_package(&bytes, platform) {
    Err(e) if e.to_string().contains("超过大小限制") => {
        Err(UserFacingError::AssetTooLarge(extract_name(&e)))
    }
    other => other,
}

Prevention

When it happens

Trigger: A ZIP entry of an allowed type whose decompressed size exceeds file_limit(base_name), or whose content is empty (0 bytes), during validate_and_read_package.

Common situations: Oversized background image or css in the theme; a zero-byte file produced by a failed build or interrupted download; accidentally zipping a placeholder file.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

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

        if file.is_dir() {
            entries.push((name, None));
            continue;
        }
        let base_name = name.rsplit('/').next().unwrap_or_default();
        if base_name == ".DS_Store" || name.starts_with("__MACOSX/") {
            entries.push((name, None));
            continue;
        }
        if !ALLOWED_FILES.contains(&base_name) {
            bail!("主题包包含不支持的文件:{name}");
        }
        let limit = file_limit(base_name);
        let mut content = Vec::new();
        file.take((limit + 1) as u64)
            .read_to_end(&mut content)
            .context("读取 Dream Skin ZIP 内容失败")?;
        if content.is_empty() || content.len() > limit {
            bail!("主题包文件 {name} 超过大小限制");
        }
        unpacked = unpacked.saturating_add(content.len());
        if unpacked > UNPACKED_LIMIT {
            bail!("Dream Skin 主题包解包后超过 64 MiB 限制");
        }
        entries.push((name, Some(content)));
    }

    let mut files = normalize_package_entries(entries)?;

    let manifest_bytes = files
        .remove("manifest.json")
        .context("主题包缺少 manifest.json")?;
    let theme_bytes = files
        .remove("theme.json")
        .context("主题包缺少 theme.json")?;
    let css_bytes = files.remove("theme.css").context("主题包缺少 theme.css")?;
    let image_name = ["background.webp", "background.jpg", "background.png"]

View on GitHub (pinned to b1ed92e5e4)