BigPizzaV3/CodexPlusPlus · error

manifest.files 数量无效

Error message

manifest.files 数量无效

What it means

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.

Solutions

  1. Ensure the package contains the required files (manifest.json, theme.json, theme.css, LICENSE.txt, one background image)
  2. Remove extra/non-whitelisted files so the total is at most 8
  3. Check the archive was fully uploaded/extracted and is not truncated
  4. List the archive contents and diff against the allowed file set before repacking

Example fix

// before: archive with 9 files incl. .DS_Store
// after: repack without .DS_Store, keeping manifest.json, theme.json, theme.css, LICENSE.txt, background.png (+ manifest.sig)
Defensive patterns

Strategy: validation

Validate before calling

let count = manifest.files.len();
if !(2..=8).contains(&count) {
    // inspect and repack the archive before calling validate_and_read_package
}
const ALLOWED: [&str; 6] = ["manifest.json","theme.json","theme.css","LICENSE.txt","manifest.sig","background.png"];
let extras: Vec<_> = manifest.files.iter().filter(|f| !ALLOWED.contains(&f.as_str())).collect();

Type guard

fn file_count_ok(files: &[String]) -> bool {
    (2..=8).contains(&files.len())
}

Try / catch

match validate_and_read_package(&path, platform) {
    Err(e) if e.to_string().contains("files 数量无效") => {
        eprintln!("package rejected: manifest.files has {} entries (need 2-8)", manifest.files.len());
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

        || manifest.license.len() > 64
        || !manifest.license.bytes().enumerate().all(|(index, byte)| {
            byte.is_ascii_alphanumeric()
                || (index > 0 && matches!(byte, b' ' | b'.' | b'+' | b'(' | b')' | b'-'))
        })
        || !safe_manifest_text(&manifest.provenance.summary, 1, 500, true)
    {
        bail!("manifest 发布者、许可证或来源说明为空");
    }
    if manifest
        .key_id
        .as_deref()
        .is_some_and(|key| !valid_key_id(key))
        || !valid_rfc3339(&manifest.created_at)
    {
        bail!("manifest keyId 或 createdAt 无效");
    }
    if manifest.files.len() < 2 || manifest.files.len() > 8 {
        bail!("manifest.files 数量无效");
    }
    Ok(())
}

fn validate_theme(
    theme: &Value,
    manifest: &DreamSkinPackageManifest,
    image_name: &str,
) -> anyhow::Result<()> {
    let object = theme.as_object().context("theme.json 必须是对象")?;
    const REQUIRED: &[&str] = &["schemaVersion", "id", "name", "image"];
    const OPTIONAL: &[&str] = &[
        "brandSubtitle",
        "tagline",
        "projectPrefix",
        "projectLabel",
        "statusText",
        "quote",

View on GitHub (pinned to b1ed92e5e4)