{"record":{"id":"8838342c1c4f50a0","repo":"BigPizzaV3/CodexPlusPlus","slug":"dreamskin-883834","errorCode":null,"errorMessage":"DreamSkin 主题包实际大小与审核元数据不一致","messagePattern":"DreamSkin 主题包实际大小与审核元数据不一致","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_community.rs","lineNumber":172,"sourceCode":"        serde_json::from_slice(&metadata_bytes).context(\"DreamSkin 主题元数据不是有效 JSON\")?;\n    validate_community_theme(&metadata)?;\n    if metadata.id != version_id {\n        bail!(\"DreamSkin 主题版本与请求不一致\");\n    }\n    if !metadata.apply_compatible {\n        bail!(\"该主题是旧格式，只支持在线预览或手动下载\");\n    }\n\n    let download_url = format!(\"{COMMUNITY_API_ORIGIN}/v1/themes/{version_id}/download\");\n    let package = download_limited(\n        &client,\n        &download_url,\n        metadata.package_bytes,\n        \"application/zip\",\n    )\n    .await?;\n    if package.len() != metadata.package_bytes {\n        bail!(\"DreamSkin 主题包实际大小与审核元数据不一致\");\n    }\n    let actual_sha = format!(\"{:x}\", Sha256::digest(&package));\n    if !actual_sha.eq_ignore_ascii_case(&metadata.package_sha256) {\n        bail!(\"DreamSkin 主题包 SHA-256 与审核元数据不一致\");\n    }\n    let validated = crate::dream_skin_package::validate_and_read_package(\n        &package,\n        if cfg!(windows) { \"windows\" } else { \"macos\" },\n    )?;\n    if validated.manifest.theme_id != metadata.theme_id\n        || validated.manifest.version != metadata.version\n    {\n        bail!(\"DreamSkin 主题包身份与审核元数据不一致\");\n    }\n    crate::dream_skin_library::save_validated_dream_skin_package(state_dir, &validated)\n}\n\npub fn import_theme_package(","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_community.rs#L154-L190","documentation":"After downloading the theme ZIP, install_community_theme compares the downloaded byte length against metadata.package_bytes recorded at review time. A mismatch means the package served by the download endpoint differs from the reviewed artifact (truncated download, replaced file, or metadata drift), so the install is aborted before any integrity-sensitive processing.","triggerScenarios":"Calling install_community_theme where the GET /v1/themes/{version_id}/download response length != metadata.package_bytes — e.g. connection drop mid-body, proxy/error page substituted for the ZIP, or the server-side file was changed after metadata was generated.","commonSituations":"Unstable network truncating a multi-MB ZIP download; a captive-portal or corporate proxy returning an HTML error page; CDN serving a partially uploaded or re-uploaded package; server-side package replaced without regenerating review metadata.","solutions":["Retry the install — transient truncation is the most common cause.","Check network/proxy: verify the download URL returns a binary ZIP (Content-Type application/zip), not an HTML error page.","Re-fetch metadata and compare sizes; if metadata.package_bytes itself changed, the theme was re-uploaded server-side.","Report to the theme maintainer/community operators if the server package persistently mismatches review metadata."],"exampleFix":"// before: blind install\ninstall_community_theme(&state_dir, version_id).await?;\n// after: pre-check on stable network\n// verify connectivity, then retry on size mismatch:\nmatch install_community_theme(&state_dir, version_id).await {\n    Err(e) if e.to_string().contains(\"大小与审核元数据不一致\") => retry_with_backoff(),\n    other => other?,\n}","handlingStrategy":"retry","validationCode":"// pre-check reachability and content type before install\nlet resp = client.head(download_url).send().await?;\nlet size = resp.headers().get(\"content-length\").and_then(|v| v.parse::<u64>().ok());\nif let Some(len) = size { if len != expected.package_bytes as u64 { return Err(\"size mismatch ahead of install\".into()); } }","typeGuard":null,"tryCatchPattern":"match install_community_theme(&state_dir, version_id).await {\n    Err(e) if e.to_string().contains(\"大小与审核元数据不一致\") => retry_with_backoff(3),\n    other => other?,\n}","preventionTips":["Install themes on a stable network; avoid captive portals and intercepting proxies.","Retry once or twice on size mismatch before reporting a server-side problem.","Re-fetch metadata if the mismatch persists — the package may have been re-uploaded."],"tags":["network","integrity-check","download","rust"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}