BigPizzaV3/CodexPlusPlus · error
manifest.files 的 SHA-256 或大小不匹配:
Error message
manifest.files 的 SHA-256 或大小不匹配:{} What it means
For each manifest.files entry, the library hashes the actual package bytes with SHA-256 and compares both the declared byte size and the digest (case-insensitive) against the manifest. If bytes differs from the real file length, or the sha256 does not match the computed digest, this error names the offending file. This guarantees package contents were not modified or corrupted relative to the signed manifest.
Solutions
- Recompute sha256 and byte size for every file and regenerate manifest.json after any content change
- Repackage the skin with the official packaging tool so hashes/sizes are computed from the final bytes
- Verify the package files were not modified or corrupted after signing (compare hashes manually with sha256sum)
- Ensure transfer of the package preserves binary content exactly
Example fix
// regenerate hashes after editing theme.css
// before (stale manifest)
{ "path": "theme.css", "bytes": 900, "sha256": "old..." }
// after
$ sha256sum theme.css # then update manifest
{ "path": "theme.css", "bytes": 1024, "sha256": "new-64-hex..." } Defensive patterns
Strategy: validation
Validate before calling
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
for (const f of manifest.files) {
const buf = readFileSync(join(pkgDir, f.path));
const digest = createHash("sha256").update(buf).digest("hex");
if (buf.length !== f.bytes || digest.toLowerCase() !== f.sha256.toLowerCase()) {
throw new Error(`${f.path}: recompute sha256/bytes and regenerate manifest.json`);
}
} Type guard
function contentMatches(buf, entry) {
const digest = createHash("sha256").update(buf).digest("hex");
return buf.length === entry.bytes && digest.toLowerCase() === entry.sha256.toLowerCase();
} Try / catch
try {
validateAndReadPackage(pkgPath);
} catch (e) {
if (String(e.message).includes("SHA-256") || String(e.message).includes("不匹配")) {
regenerateManifestFrom(pkgPath); // recompute hashes/sizes, re-sign, retry once
} else {
throw e;
}
} Prevention
- Always regenerate manifest.json as the LAST step after any file edit
- Run sha256sum on packaged files and diff against the manifest before distribution
- Never transfer packages through channels that alter bytes (text-mode transfer, re-encoding)
When it happens
Trigger: Calling validate_and_read_package where a file listed in manifest.files has different content or size than declared — e.g. the sha256 in the manifest was computed from an older version of theme.css, or the image was re-encoded without regenerating the manifest.
Common situations: Editing theme.css or theme.json after generating the manifest; re-compressing the background image; transferring the package over a mode-mangling channel (e.g. text FTP) corrupting bytes; computing the hash over a different file than the one packaged.
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
- manifest.files 缺少必需文件
- manifest.files 包含无效条目
- manifest.files 的 LICENSE.txt 与包内容不一致
- manifest.files 的 mediaType 不匹配:
- Candidate backup conflict
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/134918db17f19e17.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1133
"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())
&& value
.chars()
.all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || matches!(c, '-' | '.'))
}View on GitHub (pinned to b1ed92e5e4)