BigPizzaV3/CodexPlusPlus · error

manifest.files 包含无效条目

Error message

manifest.files 包含无效条目

What it means

validate_manifest_files validates each entry of manifest.files before hashing: the path must be unique and in the allowed list, must not re-declare manifest.json/manifest.sig, byte size must be >0 and within the per-file limit, and sha256 must be exactly 64 lowercase-hex characters. Any entry violating these rules triggers this error.

Solutions

  1. Ensure every sha256 is exactly 64 lowercase hexadecimal characters
  2. Remove duplicate or unknown paths; keep only allowed files (theme.json, theme.css, background.*, LICENSE.txt)
  3. Do not list manifest.json or manifest.sig in manifest.files
  4. Ensure each entry's bytes is > 0 and within the per-file size limit
  5. Regenerate manifest.files with the packaging tool rather than hand-editing

Example fix

// before (manifest.json)
"files": [ { "path": "theme.json", "sha256": "ABC123", "bytes": 0 } ]
// after
"files": [ { "path": "theme.json", "mediaType": "application/json", "bytes": 1024, "sha256": "a3f2...64-hex..." } ]
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(["theme.json","theme.css","background.webp","background.jpg","background.png","LICENSE.txt"]);
const seen = new Set();
for (const f of manifest.files) {
  if (seen.has(f.path)) throw new Error(`duplicate path ${f.path}`);
  seen.add(f.path);
  if (!ALLOWED.has(f.path) || f.path === "manifest.json" || f.path === "manifest.sig") throw new Error(`disallowed path ${f.path}`);
  if (!(f.bytes > 0)) throw new Error(`${f.path} bytes must be > 0`);
  if (!/^[0-9a-f]{64}$/.test(f.sha256)) throw new Error(`${f.path} sha256 must be 64 lowercase hex`);
}

Type guard

function isValidFileEntry(f) {
  return typeof f.path === "string" && typeof f.bytes === "number" && f.bytes > 0 &&
    typeof f.sha256 === "string" && /^[0-9a-f]{64}$/.test(f.sha256);
}

Prevention

When it happens

Trigger: Calling validate_and_read_package where manifest.files contains a duplicate path, an unknown path not in ALLOWED_FILES, an entry for manifest.json or manifest.sig, bytes == 0, bytes exceeding the per-file limit, or a sha256 that is not 64 lowercase hex chars.

Common situations: Generating sha256 with an uppercase-only or truncated hash; listing a 0-byte placeholder file; adding a custom extra file not in the allowed set; duplicating theme.json entries; declaring manifest.sig as a regular file entry.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

    css_bytes: &[u8],
    image_name: &str,
    image_bytes: &[u8],
    license_bytes: Option<&[u8]>,
) -> anyhow::Result<()> {
    let mut seen = HashSet::new();
    for file in &manifest.files {
        if !seen.insert(file.path.as_str())
            || !ALLOWED_FILES.contains(&file.path.as_str())
            || matches!(file.path.as_str(), "manifest.json" | "manifest.sig")
            || file.bytes == 0
            || file.bytes > file_limit(&file.path)
            || file.sha256.len() != 64
            || !file
                .sha256
                .bytes()
                .all(|b| b.is_ascii_digit() || (b'a'..=b'f').contains(&b))
        {
            bail!("manifest.files 包含无效条目");
        }
        let bytes = match file.path.as_str() {
            "manifest.json" => manifest_bytes,
            "theme.json" => theme_bytes,
            "theme.css" => css_bytes,
            path if path == image_name => image_bytes,
            "LICENSE.txt" => license_bytes.context("manifest 声明了 LICENSE.txt 但包内缺失")?,
            "manifest.sig" => continue,
            _ => continue,
        };
        let expected_media_type = match file.path.as_str() {
            "theme.json" => "application/json",
            "theme.css" => "text/css",
            "background.webp" => "image/webp",
            "background.jpg" => "image/jpeg",
            "background.png" => "image/png",
            "LICENSE.txt" => "text/plain",
            _ => "",

View on GitHub (pinned to b1ed92e5e4)