{"record":{"id":"dc5669cadb3eeb65","repo":"openai/codex","slug":"upgrade-failure-s-occurred","errorCode":null,"errorMessage":"{} upgrade failure(s) occurred.","messagePattern":"(.+?) upgrade failure\\(s\\) occurred\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"codex-rs/cli/src/marketplace_cmd.rs","lineNumber":447,"sourceCode":"    fn from_outcome(outcome: MarketplaceRemoveOutcome) -> Self {\n        Self {\n            marketplace_name: outcome.marketplace_name,\n            installed_root: outcome\n                .removed_installed_root\n                .map(|root| root.as_path().display().to_string()),\n        }\n    }\n}\n\nfn print_upgrade_outcome_json(outcome: &PluginMarketplaceUpgradeOutcome) -> Result<()> {\n    for error in &outcome.errors {\n        eprintln!(\n            \"Failed to upgrade marketplace `{}`: {}\",\n            error.marketplace_name, error.message\n        );\n    }\n    if !outcome.all_succeeded() {\n        bail!(\"{} upgrade failure(s) occurred.\", outcome.errors.len());\n    }\n\n    let output = JsonMarketplaceUpgradeOutput::from_outcome(outcome);\n    println!(\"{}\", serde_json::to_string_pretty(&output)?);\n    Ok(())\n}\n\n#[derive(Debug, Serialize)]\n#[serde(rename_all = \"camelCase\")]\nstruct JsonMarketplaceUpgradeOutput {\n    selected_marketplaces: Vec<String>,\n    upgraded_roots: Vec<String>,\n    errors: Vec<JsonMarketplaceUpgradeError>,\n}\n\nimpl JsonMarketplaceUpgradeOutput {\n    fn from_outcome(outcome: &PluginMarketplaceUpgradeOutcome) -> Self {\n        Self {","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/cli/src/marketplace_cmd.rs#L429-L465","documentation":"`codex marketplace upgrade --json` (print_upgrade_outcome_json) prints one `Failed to upgrade marketplace `name`: message` line per failure to stderr, then bails with the failure count when outcome.all_succeeded() is false. On partial failure the JSON summary is never printed, so a non-zero exit plus empty stdout is the contract for JSON consumers.","triggerScenarios":"At least one configured Git marketplace fails its upgrade step: network error during fetch/pull, dirty or conflicting working tree inside the marketplace clone, removed upstream repo, or a bad ref/branch.","commonSituations":"Offline or proxied CI runners; local commits made inside the marketplace clone under $CODEX_HOME; upstream force-push rewriting history; one broken marketplace poisoning an otherwise successful batch upgrade.","solutions":["Read the stderr lines naming each failing marketplace and its message.","Fix the named clone — `git -C <marketplace dir> status`, then stash/commit/reset local changes — or restore connectivity, and rerun.","Isolate the problem with `codex marketplace upgrade <name>`.","Remove marketplaces you no longer use (`codex marketplace remove <name>`) so one dead entry stops failing every batch run."],"exampleFix":"# before\ncodex marketplace upgrade --json > summary.json   # exits non-zero, summary.json empty\n# after: capture stderr, fix the named clones, rerun\ncodex marketplace upgrade --json >summary.json 2>err.log || grep '^Failed to upgrade marketplace' err.log\ngit -C \"$HOME/.codex/plugins/marketplaces/acme\" status   # resolve dirt/conflicts\ncodex marketplace upgrade --json > summary.json","handlingStrategy":"try-catch","validationCode":"# pre-flight: fail fast if any marketplace clone has local changes\nfor d in \"${CODEX_HOME:-$HOME/.codex}\"/plugins/marketplaces/*/; do\n  if [ -d \"$d/.git\" ] && ! git -C \"$d\" diff --quiet; then\n    echo \"dirty marketplace clone: $d\" >&2; exit 2\n  fi\ndone\ncodex marketplace upgrade --json > summary.json","typeGuard":null,"tryCatchPattern":"if ! codex marketplace upgrade --json >summary.json 2>err.log; then\n  grep '^Failed to upgrade marketplace' err.log   # one line per failing marketplace: name + message\n  exit 1\nfi\n# only parse summary.json after a zero exit; it is absent/empty on failure","preventionTips":["Treat marketplace clones as read-only caches; never commit local changes inside them","Upgrade selectively right after an upstream force-push or rename","Consume the stderr failure lines and exit code; never assume stdout JSON on failure"],"tags":["cli","codex","marketplace","upgrade","json","git"],"backgroundTag":"upgrade-failed","analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}