stablyai/orca · error · Error
GitHub request failed ${res.status} ${res.statusText}: ${bod
Error message
GitHub request failed ${res.status} ${res.statusText}: ${body.slice(0, 300)} What it means
githubJson performs an authenticated GitHub API request (Bearer token, X-GitHub-Api-Version 2022-11-28) and throws when the response is not ok (non-2xx). The message includes status, statusText, and the first 300 chars of the body so the caller can see the GitHub error message without logging the full payload.
Source
Thrown at config/scripts/latest-stable-release.mjs:42
.filter((release) => release?.draft !== true)
.map((release) => parseDesktopStableTag(release?.tag_name ?? release?.tagName ?? ''))
.filter(Boolean)
.sort((a, b) => a.major - b.major || a.minor - b.minor || a.patch - b.patch)
return stableTags.at(-1)?.tag ?? ''
}
async function githubJson(fetchImpl, url, token) {
const res = await fetchImpl(url, {
headers: {
Accept: 'application/vnd.github+json',
Authorization: `Bearer ${token}`,
'X-GitHub-Api-Version': API_VERSION
}
})
if (!res.ok) {
const body = await res.text().catch(() => '')
throw new Error(`GitHub request failed ${res.status} ${res.statusText}: ${body.slice(0, 300)}`)
}
return res.json()
}
export async function fetchReleases(repo, token, fetchImpl = fetch) {
if (!repo) {
throw new Error('repo is required')
}
if (!token) {
throw new Error('token is required')
}
const releases = []
for (let page = 1; ; page += 1) {
const pageReleases = await githubJson(
fetchImpl,
`https://api.github.com/repos/${repo}/releases?per_page=100&page=${page}`,
tokenView on GitHub (pinned to 1136503c6a)
Solutions
- Verify the token is set, valid, and has the needed scopes (repo / public_repo).
- Check the rate limit with 'gh api rate_limit' and back off if near the ceiling.
- Confirm the repo slug is correct and accessible to the token.
- Retry on 5xx with exponential backoff.
Example fix
// before
const releases = await fetchReleases(repo, token)
// after
if (!token) throw new Error('GH_TOKEN required')
let releases
try {
releases = await fetchReleases(repo, token)
} catch (err) {
throw new Error(`Could not fetch releases for ${repo}: ${err.message}`)
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!token) throw new Error('GitHub token is required')
if (!repo || !/^[^/\s]+\/[^/\s]+$/.test(repo)) throw new Error(`Invalid repo slug: ${repo}`) Try / catch
try {
releases = await fetchReleases(repo, token)
} catch (err) {
if (/401|403/.test(err.message)) throw new Error(`Auth failed for ${repo}; check token scopes`)
if (/429|rate limit/i.test(err.message)) throw new Error(`Rate limited; back off and retry`)
throw err
} Prevention
- Inject a fresh, scoped GH_TOKEN in CI and check rate_limit before large paginated calls.
- Confirm the repo slug is correct and that the token can read it.
When it happens
Trigger: Missing/invalid/expired token (401/403); rate or secondary rate limit (403/429); repo not found or no access (404); GitHub server error (5xx); wrong API version header.
Common situations: GH_TOKEN/GITHUB_TOKEN not injected in CI or expired; token lacking repo read scope; rate limit exhausted by other jobs; GITHUB_REPOSITORY pointing at a private fork the token can't read.
Related errors
- GitHub API ${method} ${path} failed with ${response.status}:
- GitHub request failed ${res.status} ${res.statusText}: ${bod
- GitHub releases response page ${page} for ${repo} was not an
- token is required
- token is required
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/eb54f0f7859cfcba.
Report an issue: GitHub.