{"record":{"id":"348c5767d7965b96","repo":"denoland/deno","slug":"failed-to-find-ci-runs-for-branch-branch-std","errorCode":null,"errorMessage":"Failed to find CI runs for branch '{branch}': {stderr}","messagePattern":"Failed to find CI runs for branch '(.+?)': (.+?)","errorType":"exception","errorClass":"AnyError","httpStatus":null,"severity":"error","filePath":"cli/tools/upgrade.rs","lineNumber":870,"sourceCode":"      \"--repo\",\n      \"denoland/deno\",\n      \"--branch\",\n      branch,\n      \"--workflow\",\n      \"ci\",\n      \"--limit\",\n      \"5\",\n      \"--json\",\n      \"databaseId\",\n      \"-q\",\n      \".[].databaseId\",\n    ])\n    .output()\n    .context(\"failed to query CI runs\")?;\n\n  if !runs_output.status.success() {\n    let stderr = String::from_utf8_lossy(&runs_output.stderr);\n    bail!(\"Failed to find CI runs for branch '{branch}': {stderr}\");\n  }\n\n  let run_ids: Vec<String> = String::from_utf8_lossy(&runs_output.stdout)\n    .trim()\n    .lines()\n    .filter(|l| !l.is_empty())\n    .map(|s| s.to_string())\n    .collect();\n\n  if run_ids.is_empty() {\n    bail!(\n      \"No CI runs found for branch '{branch}'. \\\n       CI may not have run yet.\"\n    );\n  }\n\n  let temp_dir =\n    tempfile::TempDir::new().context(\"failed to create temporary directory\")?;","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/upgrade.rs#L852-L888","documentation":"For branch installs Deno runs `gh run list --branch <branch> ...` (limited to 5 runs, JSON databaseIds) to collect CI run IDs. If that gh command exits non-zero, Deno bails with the branch name and gh's stderr. The stderr distinguishes a bad branch name from auth/network failures.","triggerScenarios":"`deno upgrade` from a branch that does not exist in denoland/deno; gh unauthenticated/expired token; GitHub API unreachable; an old gh version that does not support the flags used.","commonSituations":"Typos in branch names; referencing a remote branch that was deleted or renamed; running in CI where gh is installed but has no token; proxies blocking api.github.com.","solutions":["Re-run `gh run list --branch <branch> --repo denoland/deno --limit 5` manually and read the stderr echoed in the error.","Fix the branch name (check it exists: `git ls-remote --heads https://github.com/denoland/deno`).","Authenticate gh (`gh auth login`) or refresh an expired token.","Fix network/proxy access to GitHub if that is what stderr indicates."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"git ls-remote --heads https://github.com/denoland/deno \"refs/heads/$BRANCH\" | grep -q . || { echo \"branch not found\"; exit 1; }\ngh run list --branch \"$BRANCH\" --repo denoland/deno --limit 1 >/dev/null || gh auth login\ndeno upgrade --branch \"$BRANCH\"","typeGuard":null,"tryCatchPattern":"if ! deno upgrade --branch \"$BRANCH\" 2>err.log; then grep -q 'Failed to find CI runs' err.log && cat err.log; fi","preventionTips":["Verify the branch exists on denoland/deno before upgrading from it.","Keep gh authenticated; surface its stderr — it names the true cause.","Watch for deleted/renamed branches when copying names."],"tags":["upgrade","branch-build","gh-cli","ci","not-found"],"backgroundTag":"ci-run-lookup-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}