{"record":{"id":"47336ce0a4d22bd5","repo":"BigPizzaV3/CodexPlusPlus","slug":"downloaded-openai-plugins-marketplace-root-mismatc","errorCode":null,"errorMessage":"downloaded openai/plugins marketplace root mismatch","messagePattern":"downloaded openai/plugins marketplace root mismatch","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/plugin_marketplace.rs","lineNumber":509,"sourceCode":"        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\")\n        .join(\"plugins\")\n        .join(\"marketplace.json\");","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/plugin_marketplace.rs#L491-L527","documentation":"validate_openai_plugins_marketplace_root checks that the extracted download's root is exactly the expected local openai curated marketplace directory. local_openai_curated_marketplace_root_from_root must return Some(marketplace) equal to the root itself; if it computes a different (or nested) marketplace root, the layout is wrong and this error fires.","triggerScenarios":"install_openai_plugins_zip extracts the downloaded zip and the top-level layout does not match expectations — e.g. the zip wraps everything in an extra folder (repo-name-branch/) so the computed marketplace root is a child of the extraction root rather than the root itself.","commonSituations":"GitHub changed the repository archive layout (new top-level directory naming); a mirror produces a differently wrapped zip; the code expects marketplace metadata files (e.g. .marketplace or config) at root that are missing, making the root unrecognizable.","solutions":["Unzip the downloaded archive and compare its top-level layout with what local_openai_curated_marketplace_root_from_root expects; flatten a single wrapping directory if present","Check whether the upstream openai/plugins repo restructured and update the root-detection logic accordingly","Re-download the official archive rather than using a mirrored/modified copy"],"exampleFix":"# before (nested layout)\nextracted/openai-plugins-main/.marketplace\n# after (flattened)\nextracted/.marketplace","handlingStrategy":"validation","validationCode":"let root = extract_dir.join(\".marketplace\");\nif !root.exists() {\n    // flatten single wrapper directory before installing\n    let entries: Vec<_> = std::fs::read_dir(&extract_dir)?.collect();\n    if entries.len() == 1 { /* move child contents up */ }\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = validate_openai_plugins_marketplace_root(&root) {\n    tracing::error!(\"marketplace layout invalid: {e}\");\n    cleanup_extracted(&root);\n    return Err(e);\n}","preventionTips":["Compare extracted layout against the upstream repo structure after upstream changes","Add an integration test that installs the real archive layout","Flatten single-directory zip wrappers before validation"],"tags":["zip","marketplace","layout-validation"],"backgroundTag":"unexpected-response-shape","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"}