BigPizzaV3/CodexPlusPlus · error

manifest.files 的 mediaType 不匹配:{}

Error message

manifest.files 的 mediaType 不匹配:{}

What it means

Thrown by validate_manifest_files when a file entry's mediaType does not match the hard-coded expected MIME for its path (e.g. theme.css must be text/css, background.webp must be image/webp). The offending input is the media_type declared for {file.path} in manifest.json; the metadata must agree with the fixed content model of a Dream Skin package.

Source

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

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

View on GitHub (pinned to f2074595a2)

Solutions

  1. 把 mediaType 改为该路径对应的规范 MIME 类型
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1129 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@f2074595a2 (2026-08-23). Data as JSON: /api/errors/800c64fedd8a26b3. Report an issue: GitHub.