BigPizzaV3/CodexPlusPlus · error

manifest.files 的 LICENSE.txt 与包内容不一致

Error message

manifest.files 的 LICENSE.txt 与包内容不一致

What it means

validate_manifest_files checks that the set of files listed in a skin package's manifest.files exactly matches the actual archive contents for LICENSE.txt. The library throws this error when the manifest and the package disagree about whether a LICENSE.txt exists: either it is declared in the manifest but absent from the package, or present in the package but not declared. This is an integrity check to keep manifest metadata truthful.

Solutions

  1. Open the package archive and confirm whether LICENSE.txt actually exists in the zip.
  2. If LICENSE.txt should exist, add it back to the archive (or re-zip the full package directory).
  3. If LICENSE.txt should not exist, remove the "LICENSE.txt" entry from manifest.files.
  4. Rebuild the package with the packaging tooling rather than hand-editing the manifest so files and manifest stay in sync.
  5. Re-run validate_and_read_package to confirm the package passes validation.

Example fix

// before: manifest declares LICENSE.txt but zip lacks it
{ "files": ["theme.json", "theme.css", "wallpaper.png", "LICENSE.txt"] }
// after: manifest matches zip contents
{ "files": ["theme.json", "theme.css", "wallpaper.png"] }
Defensive patterns

Strategy: validation

Validate before calling

let manifest_files: HashSet<&str> = manifest.files.iter().map(|f| f.as_str()).collect();
let has_license_in_zip = license_bytes.is_some();
if manifest_files.contains("LICENSE.txt") != has_license_in_zip {
    return Err("manifest.files 与包内 LICENSE.txt 不一致");
}

Type guard

fn license_consistent(manifest_files: &[String], license_bytes: Option<&[u8]>) -> bool {
    manifest_files.iter().any(|f| f == "LICENSE.txt") == license_bytes.is_some()
}

Try / catch

match validate_and_read_package(path) {
    Err(e) if e.to_string().contains("LICENSE.txt 与包内容不一致") => fix_manifest_and_retry(path),
    other => other,
}

Prevention

When it happens

Trigger: Calling validate_and_read_package (which runs validate_manifest_files) on a package zip where: (a) manifest.files contains a "LICENSE.txt" entry but the archive has no LICENSE.txt bytes (license_bytes is None), or (b) the archive contains LICENSE.txt bytes but manifest.files does not list it.

Common situations: Hand-editing the manifest JSON without re-zipping; removing or adding a LICENSE.txt when repackaging a skin; zipping the directory while excluding LICENSE.txt via ignore rules; template manifests copied between packages with different license files.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

            "background.webp" => "image/webp",
            "background.jpg" => "image/jpeg",
            "background.png" => "image/png",
            "LICENSE.txt" => "text/plain",
            _ => "",
        };
        if file.media_type != expected_media_type {
            bail!("manifest.files 的 mediaType 不匹配:{}", file.path);
        }
        let actual = format!("{:x}", Sha256::digest(bytes));
        if file.bytes != bytes.len() || !actual.eq_ignore_ascii_case(&file.sha256) {
            bail!("manifest.files 的 SHA-256 或大小不匹配:{}", file.path);
        }
    }
    if !seen.contains("theme.json") || !seen.contains("theme.css") || !seen.contains(image_name) {
        bail!("manifest.files 缺少必需文件");
    }
    if seen.contains("LICENSE.txt") != license_bytes.is_some() {
        bail!("manifest.files 的 LICENSE.txt 与包内容不一致");
    }
    Ok(())
}

fn valid_theme_id(value: &str) -> bool {
    let mut chars = value.chars();
    chars.next().is_some_and(|c| c.is_ascii_alphanumeric())
        && value
            .chars()
            .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || matches!(c, '-' | '.'))
}

fn valid_semver(value: &str) -> bool {
    let parts = value.split('.').collect::<Vec<_>>();
    parts.len() == 3
        && value.len() <= 32
        && parts.iter().all(|part| {
            !part.is_empty()

View on GitHub (pinned to b1ed92e5e4)