{"record":{"id":"988a512bf2d05788","repo":"jackwener/OpenCLI","slug":"label-returned-http-resp-status-988a51","errorCode":null,"errorMessage":"${label} returned HTTP ${resp.status}","messagePattern":"(.+?) returned HTTP (.+?)","errorType":"http","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/goproxy/utils.js","lineNumber":78,"sourceCode":"async function rawFetch(url, label) {\n    let resp;\n    try {\n        resp = await fetch(url, { headers: { 'user-agent': UA } });\n    }\n    catch (err) {\n        throw new CommandExecutionError(\n            `${label} request failed: ${err?.message ?? err}`,\n            'Check that proxy.golang.org is reachable from this network.',\n        );\n    }\n    if (resp.status === 404 || resp.status === 410) {\n        throw new EmptyResultError(label, `proxy.golang.org returned ${resp.status} for ${url}.`);\n    }\n    if (resp.status === 429) {\n        throw new CommandExecutionError(`${label} returned HTTP 429 (rate limited)`);\n    }\n    if (!resp.ok) {\n        throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);\n    }\n    return resp;\n}\n\nexport async function goproxyJson(url, label) {\n    const resp = await rawFetch(url, label);\n    let body;\n    try {\n        body = await resp.json();\n    }\n    catch (err) {\n        throw new CommandExecutionError(`${label} returned malformed JSON: ${err?.message ?? err}`);\n    }\n    return body;\n}\n\nexport async function goproxyText(url, label) {\n    const resp = await rawFetch(url, label);","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/goproxy/utils.js#L60-L96","documentation":"The catch-all branch of rawFetch at clis/goproxy/utils.js:78: any non-ok response that isn't 404/410/429 (e.g. 500, 502, 503, 403) is raised as a CommandExecutionError with the status code in the message, so unexpected proxy responses surface clearly.","triggerScenarios":"proxy.golang.org returning 5xx during an outage or degraded state; a middlebox/CDN returning 403 or 451; TLS-terminating proxies injecting error pages with odd statuses; transient 502/504 from upstream.","commonSituations":"Go proxy incidents/outages; corporate SSL appliances blocking the UA or domain; regional blocks (451); brief upstream hiccups during peak load.","solutions":["Check https://status.go.dev or proxy reachability with `curl -I https://proxy.golang.org` for the same status code.","Retry once or twice with backoff for transient 5xx (502/503/504).","Investigate any in-path proxy/firewall if you see 403/451 that curl doesn't reproduce.","If the proxy is down, fall back to `go list -m -versions` via a direct VCS fetch (GOPROXY=direct) for that module."],"exampleFix":"// before\nconst info = await goproxyVersionInfo(mod, tag);   // 503 during outage\n// after\nlet info;\nfor (let i = 0; i < 3 && !info; i++) {\n  try { info = await goproxyVersionInfo(mod, tag); }\n  catch (e) { await new Promise(r => setTimeout(r, 2 ** i * 500)); }\n}","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  return await goproxyText(url, label);\n} catch (err) {\n  const m = err instanceof CommandExecutionError && /HTTP (5\\d\\d)/.exec(err.message);\n  if (m) {\n    // transient proxy outage: retry with backoff, then fall back to GOPROXY=direct\n    await new Promise(r => setTimeout(r, 3000));\n    return goproxyText(url, label);\n  }\n  throw err;\n}","preventionTips":["Monitor https://status.go.dev during incidents before bulk operations.","Build retry-with-backoff around all proxy calls; 5xx is usually transient.","Keep a fallback path (GOPROXY=direct / `go list -m`) for critical lookups.","Log the URL and status together so outage reports are actionable."],"tags":["http","server-error","goproxy","network"],"backgroundTag":"http-5xx-server-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}