{"record":{"id":"bce6eed700698504","repo":"nikivdev/code","slug":"upgrade-source-repo-not-configured-set-flow-upgra","errorCode":null,"errorMessage":"upgrade source repo not configured.\nSet FLOW_UPGRADE_REPO=owner/repo (recommended) or FLOW_GITHUB_OWNER/FLOW_GITHUB_REPO.","messagePattern":"upgrade source repo not configured\\.\nSet FLOW_UPGRADE_REPO=owner/repo \\(recommended\\) or FLOW_GITHUB_OWNER/FLOW_GITHUB_REPO\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/upgrade.rs","lineNumber":56,"sourceCode":"            if !owner.trim().is_empty() && !repo.trim().is_empty() {\n                return Ok((owner.trim().to_string(), repo.trim().to_string()));\n            }\n        }\n    }\n\n    if let (Ok(owner), Ok(repo)) = (env::var(\"FLOW_GITHUB_OWNER\"), env::var(\"FLOW_GITHUB_REPO\")) {\n        let owner = owner.trim();\n        let repo = repo.trim();\n        if !owner.is_empty() && !repo.is_empty() {\n            return Ok((owner.to_string(), repo.to_string()));\n        }\n    }\n\n    if let Some((owner, repo)) = parse_github_owner_repo(env!(\"CARGO_PKG_REPOSITORY\")) {\n        return Ok((owner, repo));\n    }\n\n    bail!(\n        \"upgrade source repo not configured.\\nSet FLOW_UPGRADE_REPO=owner/repo (recommended) or FLOW_GITHUB_OWNER/FLOW_GITHUB_REPO.\"\n    );\n}\n\n#[derive(Debug, Deserialize)]\nstruct GitHubRelease {\n    tag_name: String,\n    assets: Vec<GitHubAsset>,\n    html_url: String,\n}\n\n#[derive(Debug, Deserialize)]\nstruct GitHubAsset {\n    name: String,\n    browser_download_url: String,\n}\n\n/// Version check cache stored in ~/.cache/flow/upgrade_check.txt","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/upgrade.rs#L38-L74","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set FLOW_UPGRADE_REPO=owner/repo in the environment and retry.","Alternatively set FLOW_GITHUB_OWNER and FLOW_GITHUB_REPO.","If you build from source, add `repository = \"owner/repo\"` to the [package] section of Cargo.toml and rebuild."],"exampleFix":"// before\nlet status = flow::upgrade::check_for_upgrade_prompt();\n// after\nstd::env::set_var(\"FLOW_UPGRADE_REPO\", \"owner/flow\");\nlet status = flow::upgrade::check_for_upgrade_prompt();","handlingStrategy":"validation","validationCode":"fn upgrade_repo_configured() -> bool {\n    std::env::var(\"FLOW_UPGRADE_REPO\").is_ok()\n        || (std::env::var(\"FLOW_GITHUB_OWNER\").is_ok() && std::env::var(\"FLOW_GITHUB_REPO\").is_ok())\n}\nif !upgrade_repo_configured() {\n    eprintln!(\"Set FLOW_UPGRADE_REPO=owner/repo before upgrading\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"match flow::upgrade::check_for_upgrade_prompt() {\n    Ok(v) => { /* proceed */ }\n    Err(e) if e.to_string().contains(\"not configured\") => {\n        eprintln!(\"hint: export FLOW_UPGRADE_REPO=owner/repo\");\n    }\n    Err(e) => eprintln!(\"upgrade check failed: {e}\"),\n}","preventionTips":["Set FLOW_UPGRADE_REPO in shell profiles or CI environment for forked/local builds.","Keep the `repository` field populated in Cargo.toml so the built-in fallback works.","Validate the owner/repo value matches ^[^/]+/[^/]+$ before use.","Add a startup check that warns when self-upgrade is unconfigured."],"tags":["config","env-var","upgrade"],"backgroundTag":"missing-env-var","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}