{"record":{"id":"a6d2b149def21f33","repo":"astrid-runtime/astrid","slug":"github-api-error-querying-release-tag-candidate","errorCode":null,"errorMessage":"GitHub API error querying release tag {candidate} for {org}/{repo}: HTTP {}","messagePattern":"GitHub API error querying release tag (.+?) for (.+?)/(.+?): HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/capsule/install_github.rs","lineNumber":68,"sourceCode":"    org: &str,\n    repo: &str,\n    version: Option<&str>,\n    tag: Option<&str>,\n) -> anyhow::Result<String> {\n    if let Some(tag) = tag {\n        return Ok(tag.to_string());\n    }\n    if let Some(version) = version {\n        for candidate in [format!(\"v{version}\"), version.to_string()] {\n            let tag_url = release_tag_url(org, repo, &candidate)?;\n            let response = client.get(&tag_url).send().await.with_context(|| {\n                format!(\"failed to query release tag {candidate} for {org}/{repo}\")\n            })?;\n            if response.status() == reqwest::StatusCode::NOT_FOUND {\n                continue;\n            }\n            if !response.status().is_success() {\n                bail!(\n                    \"GitHub API error querying release tag {candidate} for {org}/{repo}: HTTP {}\",\n                    response.status()\n                );\n            }\n            let json = response\n                .json::<serde_json::Value>()\n                .await\n                .with_context(|| format!(\"invalid GitHub API response for tag {candidate}\"))?;\n            return Ok(json\n                .get(\"tag_name\")\n                .and_then(serde_json::Value::as_str)\n                .unwrap_or(&candidate)\n                .to_string());\n        }\n        bail!(\"no GitHub release found for version {version} in {org}/{repo}\");\n    }\n\n    tracing::debug!(%org, %repo, \"no version/tag pin — resolving latest release\");","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/capsule/install_github.rs#L50-L86","documentation":"resolve_github_ref queries the GitHub API for a release with the requested tag. Any non-success, non-404 HTTP status (404 is treated as 'try next candidate') aborts resolution with this error, because the CLI cannot determine whether the pinned version exists.","triggerScenarios":"install_from_github or resolve_capsule_to_file calls resolve_github_ref with a version pin; the GET to api.github.com/repos/{org}/{repo}/releases/tags/{candidate} returns a 4xx/5xx status other than NOT_FOUND.","commonSituations":"GitHub API rate limiting (403/429) from an unauthenticated client; a GitHub outage (5xx); a private repo returning 403 for an unauthenticated request; corporate proxy blocking api.github.com.","solutions":["Retry after waiting if the status is 403/429 — likely GitHub API rate limiting; set GITHUB_TOKEN to raise the limit.","Check https://www.githubstatus.com for GitHub API incidents if you see 5xx.","Verify the repo is public or provide credentials for a private repo (403).","Check network/proxy configuration that might intercept api.github.com requests."],"exampleFix":"// before (unauthenticated, rate-limited)\nastrid capsule install github:org/repo@1.2.0\n// after (authenticated, higher rate limit)\nexport GITHUB_TOKEN=ghp_...\nastrid capsule install github:org/repo@1.2.0","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// retry transient GitHub failures with backoff\nfor attempt in 0..3 {\n    match install_capsule_from_github(\"org\", \"repo\", Some(\"1.2.0\")).await {\n        Ok(_) => break,\n        Err(e) if e.to_string().contains(\"GitHub API error\") && attempt < 2 => {\n            tokio::time::sleep(std::time::Duration::from_secs(2u64.pow(attempt))).await;\n        }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Set GITHUB_TOKEN to avoid unauthenticated rate limits.","Check GitHub API status before bulk installs in CI.","Handle 403/429 with exponential backoff in automation."],"tags":["github","http","api","install"],"backgroundTag":"http-error-response","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}