BigPizzaV3/CodexPlusPlus · error
主题包背景图片内容与扩展名不一致:{name}
Error message
主题包背景图片内容与扩展名不一致:{name} What it means
Thrown by validate_image_content when the magic bytes of the packaged background image do not match its filename extension (PNG signature for background.png, JPEG 0xff d8 ff for background.jpg, RIFF....WEBP for background.webp), or the name matches none of the known backgrounds. This is a content-sniffing guard against mislabeled or disguised files; the offending input is the image entry named {name} whose bytes failed the extension check.
Source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:891
.to_string();
if files.insert(normalized.clone(), content).is_some() {
bail!("主题包包含重复文件:{normalized}");
}
}
Ok(files)
}
fn validate_image_content(name: &str, bytes: &[u8]) -> anyhow::Result<()> {
let valid = match name {
"background.png" => bytes.starts_with(&[0x89, b'P', b'N', b'G', 0x0d, 0x0a, 0x1a, 0x0a]),
"background.jpg" => bytes.starts_with(&[0xff, 0xd8, 0xff]),
"background.webp" => {
bytes.len() >= 12 && &bytes[..4] == b"RIFF" && &bytes[8..12] == b"WEBP"
}
_ => false,
};
if !valid {
bail!("主题包背景图片内容与扩展名不一致:{name}");
}
Ok(())
}
fn file_limit(name: &str) -> usize {
match name {
"manifest.json" => MANIFEST_LIMIT,
"theme.json" => THEME_LIMIT,
"theme.css" => CSS_LIMIT,
"LICENSE.txt" => LICENSE_LIMIT,
"manifest.sig" => SIGNATURE_LIMIT,
_ => IMAGE_LIMIT,
}
}
fn validate_manifest(manifest: &DreamSkinPackageManifest, platform: &str) -> anyhow::Result<()> {
if manifest.package_version != 1 || manifest.skin_api_version != 1 {
bail!("不支持的 Dream Skin 主题协议版本");View on GitHub (pinned to f2074595a2)
Solutions
- 用真实格式的图片重新打包,确保扩展名与实际编码一致
- 用 file 命令或十六进制查看器确认图片真实格式后改回正确扩展名
- 重新下载未损坏的主题包
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/codex-plus-core/src/dream_skin_package.rs:891 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/cd38b3bb9f4b362f.
Report an issue: GitHub.