{"record":{"id":"f0febdba7403b69a","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-f0febd","errorCode":null,"errorMessage":"市场主题配置与清单身份不一致","messagePattern":"市场主题配置与清单身份不一致","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_market.rs","lineNumber":137,"sourceCode":") -> anyhow::Result<DreamSkinThemeSummary> {\n    install_market_theme_from_base(state_dir, theme, DEFAULT_MARKET_RAW_BASE_URL).await\n}\n\npub async fn install_market_theme_from_base(\n    state_dir: &Path,\n    theme: &DreamSkinMarketTheme,\n    raw_base_url: &str,\n) -> anyhow::Result<DreamSkinThemeSummary> {\n    validate_market_theme(theme)?;\n    let client = market_http_client()?;\n    let theme_url = market_asset_url(raw_base_url, &theme.theme)?;\n    let image_url = market_asset_url(raw_base_url, &theme.image)?;\n    let theme_bytes = download_limited(&client, &theme_url, MARKET_THEME_LIMIT).await?;\n    verify_sha256(&theme_bytes, &theme.theme_sha256, \"主题配置\")?;\n    let config: DreamSkinThemeConfig =\n        serde_json::from_slice(&theme_bytes).context(\"市场主题配置不是有效 JSON\")?;\n    if config.id != theme.id || config.name != theme.name {\n        bail!(\"市场主题配置与清单身份不一致\");\n    }\n\n    let image_bytes = download_limited(&client, &image_url, MARKET_IMAGE_LIMIT).await?;\n    verify_sha256(&image_bytes, &theme.image_sha256, \"主题图片\")?;\n    let extension =\n        detect_image_extension(&image_bytes).context(\"市场主题图片格式无效或不受支持\")?;\n    let download_path = market_download_path(state_dir, &theme.id, extension)?;\n    crate::settings::atomic_write(&download_path, &image_bytes)\n        .with_context(|| format!(\"无法暂存市场主题图片 {}\", download_path.display()))?;\n\n    let draft = DreamSkinThemeDraft {\n        config,\n        image_path: download_path.to_string_lossy().into_owned(),\n        builtin: false,\n    };\n    let installed = crate::dream_skin_library::save_dream_skin_theme(state_dir, &draft);\n    let _ = std::fs::remove_file(&download_path);\n    let installed = installed?;","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_market.rs#L119-L155","documentation":"After downloading and SHA-256-verifying a market theme, install_market_theme_from_base parses the theme config and checks that its id and name match the marketplace manifest entry being installed. A mismatch means the hosted theme.json does not correspond to the manifest record, so installation is aborted to prevent installing mislabeled or swapped content.","triggerScenarios":"The downloaded theme.json has an id or name different from the DreamSkinMarketTheme entry passed to install_market_theme — typically because the market publisher updated/renamed the theme in theme.json without regenerating the manifest hashes/fields, or the manifest points at the wrong asset path.","commonSituations":"Theme author edits the theme name/id in their repo but forgets to update the market manifest entry; manifest asset paths are stale after a restructure; a mirror serves an outdated theme.json whose hash happens to match an old manifest.","solutions":["Ask the theme publisher to update the market manifest so theme.id/theme.name match the id/name inside the published theme.json (and recompute theme_sha256)","Verify the manifest entry's theme path points at the correct theme.json (not another theme's file)","Retry after the manifest is fixed; if you mirror the market, refresh your mirror from upstream","If you author the theme, keep id/name identical in theme.json and the manifest entry"],"exampleFix":"// manifest entry before (mismatch)\n{ \"id\": \"cool-theme\", \"name\": \"Cool Theme\", \"theme\": \"themes/cool-theme/theme.json\" } // theme.json contains id: \"old-theme\"\n// after — publish theme.json with matching identity and update sha256\n{ \"id\": \"cool-theme\", \"name\": \"Cool Theme\", \"theme\": \"themes/cool-theme/theme.json\", \"theme_sha256\": \"<new hash of theme.json whose id==cool-theme>\" }","handlingStrategy":"try-catch","validationCode":"// after fetching the manifest entry, before installing, you cannot fully verify without downloading;\n// at minimum check the manifest record is internally consistent and pinned by hash:\nif theme.theme_sha256.is_empty() || theme.id.is_empty() || theme.name.is_empty() {\n    return Err(anyhow::anyhow!(\"manifest entry missing id/name/hash\"));\n}","typeGuard":null,"tryCatchPattern":"match install_market_theme(state_dir, &theme).await {\n    Ok(summary) => println!(\"installed {}\", summary.id),\n    Err(e) if e.to_string().contains(\"身份不一致\") => {\n        eprintln!(\"market asset does not match manifest identity — report to the theme publisher and skip this theme\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Publish theme.json and the manifest entry from the same build step so id/name always match","Recompute theme_sha256 whenever theme.json changes","Treat this error as a supply-chain signal: do not bypass it or patch around the check","Pin and verify manifest source; avoid third-party mirrors with stale assets"],"tags":["security","marketplace","integrity"],"backgroundTag":"checksum-mismatch","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"}