{"record":{"id":"f512b0fcbf6e8761","repo":"nextlevelbuilder/ui-ux-pro-max-skill","slug":"failed-to-fetch-releases-response-status-res","errorCode":null,"errorMessage":"Failed to fetch releases: ${response.status} ${response.statusText}","messagePattern":"Failed to fetch releases: (.+?) (.+?)","errorType":"http","errorClass":"GitHubDownloadError","httpStatus":null,"severity":"error","filePath":"cli/src/utils/github.ts","lineNumber":68,"sourceCode":"  const resolved = (token || process.env['UI_PRO_MAX_GITHUB_TOKEN'] || process.env['GITHUB_TOKEN'])?.trim();\n  return resolved ? { 'Authorization': `Bearer ${resolved}` } : {};\n}\n\nexport async function fetchReleases(token?: string): Promise<Release[]> {\n  const url = `${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/releases`;\n\n  const response = await fetch(url, {\n    headers: {\n      'Accept': 'application/vnd.github.v3+json',\n      'User-Agent': USER_AGENT,\n      ...getAuthHeaders(token),\n    },\n  });\n\n  checkRateLimit(response);\n\n  if (!response.ok) {\n    throw new GitHubDownloadError(`Failed to fetch releases: ${response.status} ${response.statusText}`);\n  }\n\n  return response.json();\n}\n\nexport async function getLatestRelease(token?: string): Promise<Release> {\n  const url = `${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest`;\n\n  const response = await fetch(url, {\n    headers: {\n      'Accept': 'application/vnd.github.v3+json',\n      'User-Agent': USER_AGENT,\n      ...getAuthHeaders(token),\n    },\n  });\n\n  checkRateLimit(response);\n","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/nextlevelbuilder/ui-ux-pro-max-skill/blob/a38d04c3d5c298c851dbe5e6ee1965ee3de42cb5/cli/src/utils/github.ts#L50-L86","documentation":"fetchReleases() lists a repo's releases via GET /repos/{owner}/{repo}/releases; after checkRateLimit() passes, any other non-2xx response is wrapped in GitHubDownloadError with the HTTP status and reason. This covers everything that is not a rate limit: 401 bad token, 404 wrong repo/owner constants, 5xx GitHub outages, redirects, etc.","triggerScenarios":"A stale or revoked token producing 401 Bad credentials; REPO_OWNER/REPO_NAME constants pointing at a renamed or transferred repository (404); GitHub API returning 5xx; a corporate proxy rewriting responses.","commonSituations":"The project's repo was renamed/moved after the CLI version was published; an expired PAT left in the environment; GitHub incidents; typos when someone forks and retargets the constants.","solutions":["Reproduce the raw call to see the exact status: `curl -i https://api.github.com/repos/<owner>/<repo>/releases`.","If 401, remove or refresh the token in UI_PRO_MAX_GITHUB_TOKEN/GITHUB_TOKEN (an invalid token is worse than none).","If 404, verify the owner/repo name encoded in github.ts still matches the live repository; update the CLI to a version pointing at the new name.","If 5xx, retry later and check githubstatus.com."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"import { GitHubDownloadError, fetchReleases } from './utils/github';\n\ntry {\n  const releases = await fetchReleases(token);\n} catch (e) {\n  if (e instanceof GitHubDownloadError) {\n    const status = e.message.match(/(\\d{3})/)?.[1];\n    if (status === '401') console.error('Token rejected - unset UI_PRO_MAX_GITHUB_TOKEN/GITHUB_TOKEN or refresh it.');\n    if (status === '404') console.error('Repo not found - owner/repo moved? Update the CLI.');\n    if (status?.startsWith('5')) console.error('GitHub incident - retry later / check githubstatus.com.');\n  }\n  throw e;\n}","preventionTips":["Smoke-test the endpoint (curl -i) when wiring the CLI into new environments.","Keep tokens fresh; an invalid token is worse than none for public repos.","Update the CLI after repo renames so owner/repo constants track the new location."],"tags":["github-api","http-status","network","cli"],"backgroundTag":null,"analyzedSha":"a38d04c3d5c298c851dbe5e6ee1965ee3de42cb5","analyzedAt":"2026-08-14T18:51:02.321Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}