{"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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/plugin_marketplace.rs","lineNumber":480,"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":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/1f431ae49b57b3055e0e6845ba6156c6b4232b4d/crates/codex-plus-core/src/plugin_marketplace.rs#L462-L498","documentation":"validate_openai_plugins_marketplace_root (crates/codex-plus-core/src/plugin_marketplace.rs:479-481) compares the marketplace root computed by local_openai_curated_marketplace_root_from_root with the extraction root; a mismatch bails with 'root mismatch'. In the current implementation the helper only ever returns Some(root.to_path_buf()) or None, so the mismatch branch is defensive — reserved for future variants of the root-resolution logic (e.g. searching subdirectories) where the discovered manifest sits below the passed root. If you see it, you are running modified resolution code.","triggerScenarios":"A fork or future version of local_openai_curated_marketplace_root_from_root that returns a directory different from the root argument (e.g. scanning for .agents/ under nested folders) while validate_openai_plugins_marketplace_root still requires equality — stock builds cannot produce this error.","commonSituations":"Local forks teaching the validator to locate the manifest in nested layouts without updating the equality check; merges that change one function but not its caller; experimental builds during marketplace-layout migrations.","solutions":["If you maintain a fork with nested-root discovery, either normalize the extraction root (strip the extra folder before validating) or relax the equality check to `marketplace.starts_with(root)`/containment as appropriate","Re-extract the zip so the manifest sits at the root the validator expects (pack from inside the marketplace root)","In stock builds, treat a hit as a canary: diff your plugin_marketplace.rs against upstream, since upstream code paths return None (error 37) instead"],"exampleFix":"// before: fork discovers nested manifest, equality fails\nlet marketplace = find_marketplace_root_anywhere(root)?; // e.g. root/openai-plugins/\nif marketplace != root { bail!(\"root mismatch\"); }\n\n// after: validate containment\nif !marketplace.starts_with(root) { bail!(\"root mismatch\"); }","handlingStrategy":"validation","validationCode":"// If using a fork with nested-root discovery, verify equality before install\nfn roots_consistent(root: &Path, discovered: Option<&Path>) -> bool {\n    match discovered { Some(d) => d == root, None => false }\n}","typeGuard":"fn same_root(a: &Path, b: &Path) -> bool {\n    a == b\n}","tryCatchPattern":"Err(e) if e.to_string().contains(\"marketplace root mismatch\") => {\n    // fork invariant: re-extract so the manifest sits at root, or fix containment logic\n    anyhow::bail!(\"marketplace layout changed; re-pack with manifest at the archive root\")\n}","preventionTips":["Keep root-resolution helpers and their equality checks in one change unit when refactoring","Pack zips from inside the marketplace root so discovered root == extraction root","Add tests asserting validate_* accept the shipped fixture verbatim"],"tags":["rust","plugin-marketplace","validation","layout","defensive-check"],"backgroundTag":"marketplace-layout-mismatch","analyzedSha":"1f431ae49b57b3055e0e6845ba6156c6b4232b4d","analyzedAt":"2026-08-16T20:54:18.598Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}