nikivdev/code · error

upgrade source repo not configured. Set FLOW_UPGRADE_REPO=ow

Error message

upgrade source repo not configured.
Set FLOW_UPGRADE_REPO=owner/repo (recommended) or FLOW_GITHUB_OWNER/FLOW_GITHUB_REPO.

What it means

Raised by `upgrade_repo` when it cannot determine which GitHub owner/repo to query for releases. It first checks FLOW_UPGRADE_REPO (or FLOW_GITHUB_OWNER/FLOW_GITHUB_REPO) and then falls back to parsing the crate's CARGO_PKG_REPOSITORY metadata; if all three are absent, it bails.

Source

Thrown at src/upgrade.rs:56

            if !owner.trim().is_empty() && !repo.trim().is_empty() {
                return Ok((owner.trim().to_string(), repo.trim().to_string()));
            }
        }
    }

    if let (Ok(owner), Ok(repo)) = (env::var("FLOW_GITHUB_OWNER"), env::var("FLOW_GITHUB_REPO")) {
        let owner = owner.trim();
        let repo = repo.trim();
        if !owner.is_empty() && !repo.is_empty() {
            return Ok((owner.to_string(), repo.to_string()));
        }
    }

    if let Some((owner, repo)) = parse_github_owner_repo(env!("CARGO_PKG_REPOSITORY")) {
        return Ok((owner, repo));
    }

    bail!(
        "upgrade source repo not configured.\nSet FLOW_UPGRADE_REPO=owner/repo (recommended) or FLOW_GITHUB_OWNER/FLOW_GITHUB_REPO."
    );
}

#[derive(Debug, Deserialize)]
struct GitHubRelease {
    tag_name: String,
    assets: Vec<GitHubAsset>,
    html_url: String,
}

#[derive(Debug, Deserialize)]
struct GitHubAsset {
    name: String,
    browser_download_url: String,
}

/// Version check cache stored in ~/.cache/flow/upgrade_check.txt

View on GitHub (pinned to a747e741ae)

Solutions

  1. Set FLOW_UPGRADE_REPO=owner/repo in the environment and retry.
  2. Alternatively set FLOW_GITHUB_OWNER and FLOW_GITHUB_REPO.
  3. If you build from source, add `repository = "owner/repo"` to the [package] section of Cargo.toml and rebuild.

Example fix

// before
let status = flow::upgrade::check_for_upgrade_prompt();
// after
std::env::set_var("FLOW_UPGRADE_REPO", "owner/flow");
let status = flow::upgrade::check_for_upgrade_prompt();
Defensive patterns

Strategy: validation

Validate before calling

fn upgrade_repo_configured() -> bool {
    std::env::var("FLOW_UPGRADE_REPO").is_ok()
        || (std::env::var("FLOW_GITHUB_OWNER").is_ok() && std::env::var("FLOW_GITHUB_REPO").is_ok())
}
if !upgrade_repo_configured() {
    eprintln!("Set FLOW_UPGRADE_REPO=owner/repo before upgrading");
    return;
}

Try / catch

match flow::upgrade::check_for_upgrade_prompt() {
    Ok(v) => { /* proceed */ }
    Err(e) if e.to_string().contains("not configured") => {
        eprintln!("hint: export FLOW_UPGRADE_REPO=owner/repo");
    }
    Err(e) => eprintln!("upgrade check failed: {e}"),
}

Prevention

When it happens

Trigger: Calling `fetch_latest_release`, `fetch_release_by_tag`, or `run` (self-upgrade/check-for-upgrade) on a binary built without a `repository` field in Cargo.toml and with none of FLOW_UPGRADE_REPO, FLOW_GITHUB_OWNER, FLOW_GITHUB_REPO set in the environment.

Common situations: Forked or locally rebuilt binaries where Cargo.toml repository metadata was stripped or changed; running in a minimal CI/container environment without the env vars; vendored builds.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/bce6eed700698504. Report an issue: GitHub.