BigPizzaV3/CodexPlusPlus · error

manifest.files 缺少必需文件

Error message

manifest.files 缺少必需文件

What it means

After the per-file loop, validate_manifest_files requires the package to contain at least the essential files: theme.json, theme.css, and the manifest-declared background image (image_name). If any of these paths was not seen among manifest.files entries, this error is thrown. LICENSE.txt is handled separately as optional-but-consistent.

Solutions

  1. Add manifest.files entries for theme.json, theme.css, and the background image named by the manifest's image field
  2. Make the image entry path exactly match the image filename declared elsewhere in the manifest
  3. Regenerate the manifest with the packaging tool to guarantee required entries are emitted

Example fix

// before (manifest missing css entry)
"files": [ { "path": "theme.json", ... }, { "path": "background.webp", ... } ]
// after
"files": [ { "path": "theme.json", "mediaType": "application/json", ... }, { "path": "theme.css", "mediaType": "text/css", ... }, { "path": "background.webp", "mediaType": "image/webp", ... } ]
Defensive patterns

Strategy: validation

Validate before calling

const paths = new Set(manifest.files.map(f => f.path));
const required = ["theme.json", "theme.css", manifest.image];
for (const p of required) {
  if (!paths.has(p)) throw new Error(`manifest.files is missing required file: ${p}`);
}

Type guard

function hasRequiredFiles(manifest) {
  const paths = new Set(manifest.files.map(f => f.path));
  return ["theme.json", "theme.css", manifest.image].every(p => paths.has(p));
}

Prevention

When it happens

Trigger: Calling validate_and_read_package where manifest.files omits theme.json, omits theme.css, or omits an entry whose path equals the manifest's declared background image filename — even if the file bytes exist in the package but are simply not listed.

Common situations: Building a manifest by hand and forgetting one entry; listing the image under a different name than the manifest's image field (e.g. bg.png vs background.png); stripping entries while pruning file size; a packaging bug skipping the CSS file.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

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

        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",
            _ => "",
        };
        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

View on GitHub (pinned to b1ed92e5e4)