{"record":{"id":"c400b59f06529ca8","repo":"google-gemini/gemini-cli","slug":"invalid-response-code-downloading-endpoint-r","errorCode":null,"errorMessage":"Invalid response code downloading ${endpoint}: ${response.status} - ${response.statusText}","messagePattern":"Invalid response code downloading (.+?): (.+?) - (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/ui/commands/setupGithubCommand.ts","lineNumber":139,"sourceCode":"  const downloads = [];\n  for (const fileBasename of paths) {\n    downloads.push(\n      (async () => {\n        const endpoint = `${REPO_DOWNLOAD_URL}/refs/tags/${releaseTag}/${SOURCE_DIR}/${fileBasename}`;\n        const response = await fetch(endpoint, {\n          method: 'GET',\n          dispatcher: proxy ? new ProxyAgent(proxy) : undefined,\n          /* eslint-disable @typescript-eslint/no-unsafe-type-assertion */\n          signal: (\n            AbortSignal as unknown as {\n              any: (signals: AbortSignal[]) => AbortSignal;\n            }\n          ).any([AbortSignal.timeout(30_000), abortController.signal]),\n          /* eslint-enable @typescript-eslint/no-unsafe-type-assertion */\n        } as RequestInit);\n\n        if (!response.ok) {\n          throw new Error(\n            `Invalid response code downloading ${endpoint}: ${response.status} - ${response.statusText}`,\n          );\n        }\n        const body = response.body;\n        if (!body) {\n          throw new Error(\n            `Empty body while downloading ${endpoint}: ${response.status} - ${response.statusText}`,\n          );\n        }\n\n        const destination = path.resolve(\n          targetDir,\n          path.basename(fileBasename),\n        );\n\n        const fileStream = fs.createWriteStream(destination, {\n          mode: 0o644, // -rw-r--r--, user(rw), group(r), other(r)\n          flags: 'w', // write and overwrite","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/ui/commands/setupGithubCommand.ts#L121-L157","documentation":"Thrown by downloadFiles() during /setup-github when the fetch to raw.githubusercontent.com returns a non-2xx status. The endpoint is built from REPO_DOWNLOAD_URL + the release tag + examples/workflows/<file>. A 404 means the tag/path is wrong; 403 typically means GitHub rate limiting.","triggerScenarios":"fetch(endpoint) returns response.ok === false for a workflow file URL; common codes are 404 (release tag/path mismatch) or 403 (unauthenticated GitHub raw-content rate limit).","commonSituations":"getLatestGitHubRelease returned an unexpected/tag that lacks the examples/workflows files; GitHub raw content rate-limited the unauthenticated request; network/proxy returned an error page; the repo path structure changed in a newer release.","solutions":["Retry shortly after — transient 403s from raw.githubusercontent.com rate limits usually clear.","Check network/proxy connectivity and the configured proxy (config.getProxy()) if one is set.","Verify the latest release tag of google-github-actions/run-gemini-cli actually contains examples/workflows/<file>.","If behind a proxy or offline, configure GEMINI_PROXY / the proxy setting or run from a network with access to GitHub."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function endpointReachable(endpoint: string, proxy?: string): Promise<boolean> {\n  const res = await fetch(endpoint, { method: 'HEAD', dispatcher: proxy ? new ProxyAgent(proxy) : undefined, signal: AbortSignal.timeout(10_000) } as RequestInit);\n  return res.ok || res.status === 200;\n}","typeGuard":"function isHttpStatusError(e: unknown): boolean {\n  return e instanceof Error && /Invalid response code downloading/.test(e.message);\n}","tryCatchPattern":"for (let attempt = 1; attempt <= 3; attempt++) {\n  try { await runSetupGithub(ctx); break; }\n  catch (e) {\n    if (e instanceof Error && /Invalid response code downloading/.test(e.message) && attempt < 3) continue;\n    throw e;\n  }\n}","preventionTips":["Retry transient GitHub raw-content 403s (unauthenticated rate limits clear quickly).","Configure a proxy (config.getProxy()) when operating behind a corporate egress.","Confirm the latest release tag contains examples/workflows before running /setup-github."],"tags":["network","github","download","http","setup-github","rate-limit"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}