{"record":{"id":"4d92cba0c8b63aff","repo":"BigPizzaV3/CodexPlusPlus","slug":"embedded-official-remote-plugin-marketplace-is-inv","errorCode":null,"errorMessage":"embedded official remote plugin marketplace is invalid","messagePattern":"embedded official remote plugin marketplace is invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/plugin_marketplace.rs","lineNumber":516,"sourceCode":"            Component::CurDir => {}\n            _ => return None,\n        }\n    }\n    (!relative.as_os_str().is_empty()).then_some(relative)\n}\n\nfn validate_openai_plugins_marketplace_root(root: &Path) -> anyhow::Result<()> {\n    let marketplace = local_openai_curated_marketplace_root_from_root(root)?\n        .ok_or_else(|| anyhow::anyhow!(\"downloaded openai/plugins marketplace is invalid\"))?;\n    if marketplace != root {\n        anyhow::bail!(\"downloaded openai/plugins marketplace root mismatch\");\n    }\n    Ok(())\n}\n\nfn validate_openai_curated_remote_marketplace_root(root: &Path) -> anyhow::Result<()> {\n    let marketplace = local_openai_curated_remote_marketplace_root_from_root(root)?\n        .ok_or_else(|| anyhow::anyhow!(\"embedded official remote plugin marketplace is invalid\"))?;\n    if marketplace != root {\n        anyhow::bail!(\"embedded official remote plugin marketplace root mismatch\");\n    }\n    Ok(())\n}\n\nfn local_openai_curated_marketplace_root_from_root(root: &Path) -> anyhow::Result<Option<PathBuf>> {\n    let marketplace_path = root\n        .join(\".agents\")\n        .join(\"plugins\")\n        .join(\"marketplace.json\");\n    if !marketplace_path.is_file() {\n        return Ok(None);\n    }\n    let text = std::fs::read_to_string(&marketplace_path)\n        .with_context(|| format!(\"failed to read {}\", marketplace_path.display()))?;\n    let marketplace: serde_json::Value = serde_json::from_str(&text)\n        .with_context(|| format!(\"failed to parse {}\", marketplace_path.display()))?;","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/plugin_marketplace.rs#L498-L534","documentation":"validate_openai_curated_remote_marketplace_root checks that an extracted embedded official remote-plugin-marketplace zip contains the expected curated remote marketplace directory. If the expected directory cannot be located, the archive is deemed invalid and this error is thrown; if the found directory differs from the root, a 'root mismatch' error follows.","triggerScenarios":"install_openai_curated_remote_marketplace_zip extracted a zip that lacks the expected remote marketplace subdirectory that local_openai_curated_remote_marketplace_root_from_root looks for.","commonSituations":"Upstream marketplace repo renamed/moved the directory; wrong archive downloaded; corrupt or truncated zip extraction; older cached layout on disk.","solutions":["Inspect the extracted directory and confirm the expected remote-marketplace folder exists at the expected path.","Re-download the zip; verify its integrity (size, unzip without errors).","Purge the cached marketplace install directory and retry.","Update the expected-root resolution logic to match the new upstream layout if the repo restructured."],"exampleFix":"// before: assume layout\nlet root = extract_dir.join(\"marketplace\");\n// after: validate before install\nvalidate_openai_curated_remote_marketplace_root(&extract_dir)?;\ninstall_openai_curated_remote_marketplace_zip(&extract_dir)?;","handlingStrategy":"validation","validationCode":"if !extract_dir.join(\"expected-marketplace-dir\").exists() {\n    anyhow::bail!(\"extracted archive lacks remote marketplace directory\");\n}","typeGuard":"fn has_remote_marketplace(root: &Path) -> bool {\n    local_openai_curated_remote_marketplace_root_from_root(root)\n        .map(|m| m.is_some()).unwrap_or(false)\n}","tryCatchPattern":"match install_openai_curated_remote_marketplace_zip(&bytes).await {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"remote plugin marketplace is invalid\") => {\n        fs::remove_dir_all(&cache_dir)?; // purge and retry once\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify archive integrity (size/unzip test) before extraction","Purge stale cached extractions when upstream layout changes","Keep the expected-root resolution in sync with the upstream repo structure"],"tags":["marketplace","zip-validation","plugins"],"backgroundTag":"schema-validation-failed","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"}