openai/codex · error · anyhow::Error

{} upgrade failure(s) occurred.

Error message

{} upgrade failure(s) occurred.

What it means

`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.

Source

Thrown at codex-rs/cli/src/marketplace_cmd.rs:447

    fn from_outcome(outcome: MarketplaceRemoveOutcome) -> Self {
        Self {
            marketplace_name: outcome.marketplace_name,
            installed_root: outcome
                .removed_installed_root
                .map(|root| root.as_path().display().to_string()),
        }
    }
}

fn print_upgrade_outcome_json(outcome: &PluginMarketplaceUpgradeOutcome) -> Result<()> {
    for error in &outcome.errors {
        eprintln!(
            "Failed to upgrade marketplace `{}`: {}",
            error.marketplace_name, error.message
        );
    }
    if !outcome.all_succeeded() {
        bail!("{} upgrade failure(s) occurred.", outcome.errors.len());
    }

    let output = JsonMarketplaceUpgradeOutput::from_outcome(outcome);
    println!("{}", serde_json::to_string_pretty(&output)?);
    Ok(())
}

#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct JsonMarketplaceUpgradeOutput {
    selected_marketplaces: Vec<String>,
    upgraded_roots: Vec<String>,
    errors: Vec<JsonMarketplaceUpgradeError>,
}

impl JsonMarketplaceUpgradeOutput {
    fn from_outcome(outcome: &PluginMarketplaceUpgradeOutcome) -> Self {
        Self {

View on GitHub (pinned to 339751715c)

Solutions

  1. Read the stderr lines naming each failing marketplace and its message.
  2. Fix the named clone — `git -C <marketplace dir> status`, then stash/commit/reset local changes — or restore connectivity, and rerun.
  3. Isolate the problem with `codex marketplace upgrade <name>`.
  4. Remove marketplaces you no longer use (`codex marketplace remove <name>`) so one dead entry stops failing every batch run.

Example fix

# before
codex marketplace upgrade --json > summary.json   # exits non-zero, summary.json empty
# after: capture stderr, fix the named clones, rerun
codex marketplace upgrade --json >summary.json 2>err.log || grep '^Failed to upgrade marketplace' err.log
git -C "$HOME/.codex/plugins/marketplaces/acme" status   # resolve dirt/conflicts
codex marketplace upgrade --json > summary.json
Defensive patterns

Strategy: try-catch

Validate before calling

# pre-flight: fail fast if any marketplace clone has local changes
for d in "${CODEX_HOME:-$HOME/.codex}"/plugins/marketplaces/*/; do
  if [ -d "$d/.git" ] && ! git -C "$d" diff --quiet; then
    echo "dirty marketplace clone: $d" >&2; exit 2
  fi
done
codex marketplace upgrade --json > summary.json

Try / catch

if ! codex marketplace upgrade --json >summary.json 2>err.log; then
  grep '^Failed to upgrade marketplace' err.log   # one line per failing marketplace: name + message
  exit 1
fi
# only parse summary.json after a zero exit; it is absent/empty on failure

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/dc5669cadb3eeb65. Report an issue: GitHub.