{"record":{"id":"053c1ec01298ba01","repo":"BigPizzaV3/CodexPlusPlus","slug":"downloaded-openai-plugins-marketplace-is-invalid","errorCode":null,"errorMessage":"downloaded openai/plugins marketplace is invalid","messagePattern":"downloaded openai/plugins marketplace is invalid","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/plugin_marketplace.rs","lineNumber":507,"sourceCode":"    let mut components = path.components();\n    match components.next()? {\n        Component::Normal(_) => {}\n        _ => return None,\n    }\n    let mut relative = PathBuf::new();\n    for component in components {\n        match component {\n            Component::Normal(value) => relative.push(value),\n            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\")","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/plugin_marketplace.rs#L489-L525","documentation":"After extracting a downloaded openai/plugins marketplace zip, validate_openai_plugins_marketplace_root locates the expected curated marketplace directory inside the extracted root. If the expected directory structure is not found (local_openai_curated_marketplace_root_from_root returns None) the archive is considered invalid and this error is thrown.","triggerScenarios":"install_openai_plugins_zip downloaded and extracted a zip whose layout does not contain the expected plugins-<something>/ or marketplace subdirectory the validator looks for.","commonSituations":"openai/plugins repository restructured its zip layout; user downloaded the wrong archive (source zip vs release artifact); a proxy/CDN returned an HTML error page saved as .zip; partial/corrupt download.","solutions":["Unzip the downloaded archive and verify it contains the expected marketplace directory (e.g. plugins-* with marketplace.json / plugin manifests).","Re-download the marketplace zip from the correct upstream URL; check for proxy/CDN corruption.","Clear the cached marketplace directory so a stale/corrupt extraction is not reused.","Pin/adjust the expected root layout if the upstream repo changed its folder structure."],"exampleFix":"// before: trust any downloaded zip\ninstall_openai_plugins_zip(&zip_bytes).await?;\n// after: sanity-check zip content marker before install\nif !zip_bytes.starts_with(&[0x50, 0x4B]) {\n    anyhow::bail!(\"downloaded marketplace is not a zip (HTML error page?)\");\n}\ninstall_openai_plugins_zip(&zip_bytes).await?;","handlingStrategy":"validation","validationCode":"fn is_zip(bytes: &[u8]) -> bool { bytes.starts_with(b\"PK\") }\nif !is_zip(&downloaded) {\n    anyhow::bail!(\"marketplace download is not a valid zip\");\n}","typeGuard":"fn marketplace_root_valid(root: &Path) -> bool {\n    root.join(\"plugins\").is_dir() || local_openai_curated_marketplace_root_from_root(root).is_ok()\n}","tryCatchPattern":"match install_openai_plugins_zip(&bytes).await {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"marketplace is invalid\") => {\n        // delete cache, re-download once\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify download URL returns an actual zip (magic bytes PK), not an HTML error page","Cache the zip with a checksum and re-download on mismatch","Check for upstream repo layout changes before pinning versions"],"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"}