{"record":{"id":"08530738feb3c194","repo":"abhigyanpatwari/GitNexus","slug":"registry-returned-response-status","errorCode":null,"errorMessage":"Registry returned ${response.status}","messagePattern":"Registry returned (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/update-check.ts","lineNumber":195,"sourceCode":"  let url = sanitizedHttpUrl(packageUrl);\n  for (let redirects = 0; ; redirects += 1) {\n    const response = await fetch(url.toString(), {\n      method: 'GET',\n      redirect: 'manual',\n      headers: { accept: 'application/json' },\n      signal: AbortSignal.timeout(FETCH_TIMEOUT_MS),\n    });\n    if (response.status >= 300 && response.status < 400) {\n      if (redirects >= MAX_REDIRECTS) throw new Error('Too many registry redirects');\n      const location = response.headers.get('location');\n      await response.body?.cancel().catch(() => {});\n      if (!location) throw new Error('Registry redirect missing location');\n      url = sanitizedHttpUrl(location, url.toString());\n      continue;\n    }\n    if (!response.ok) {\n      await response.body?.cancel().catch(() => {});\n      throw new Error(`Registry returned ${response.status}`);\n    }\n    const parsed = JSON.parse(await readResponseBody(response)) as {\n      version?: unknown;\n      'dist-tags'?: { latest?: unknown };\n    };\n    const latest =\n      (typeof parsed.version === 'string' ? parsed.version : undefined) ??\n      (typeof parsed['dist-tags']?.latest === 'string' ? parsed['dist-tags'].latest : undefined);\n    if (typeof latest !== 'string' || !STRICT_UPDATE_VERSION.test(latest)) {\n      throw new Error('Registry latest version is invalid');\n    }\n    return latest;\n  }\n}\n\nasync function publishMonotonically(\n  entry: UpdateCacheEntry,\n  attemptStartedAt: number,","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/core/update-check.ts#L177-L213","documentation":"fetchLatest throws `Registry returned ${status}` for any non-2xx, non-3xx response from the update registry (the body is cancelled first). The message interpolates the actual HTTP status code, so the rendered error tells you exactly what the registry answered — 404, 403, 500, etc.","triggerScenarios":"The configured registry URL returns 404 (wrong path/package), 403 (blocked/rate-limited/UA-filtered), 429, or 5xx; a proxy answers 502/503 on the registry's behalf.","commonSituations":"Typo'd registry URL or package name path; corporate firewall returning 403 for unknown agents; registry outage or rate limiting; a custom mirror that only serves some paths.","solutions":["Read the interpolated status in the message and act on it (404 → fix URL/path; 403/429 → auth or rate limit; 5xx → wait/retry or check registry status page)","Verify the URL with curl -i <registry-url> from the same network to reproduce outside GitNexus","Correct the registry configuration (host/path) or switch to the canonical registry"],"exampleFix":"// before (404 because package path missing)\n// Registry returned 404\n// after\nbuildUpdateRegistry('https://registry.npmjs.org'); // correct base, resolves the right package URL","handlingStrategy":"retry","validationCode":"const probe = await fetch(registryUrl); if (!probe.ok) console.warn(`Registry currently returns ${probe.status}; update check will fail`);","typeGuard":null,"tryCatchPattern":"try { const latest = await fetchLatest(url, 0); } catch (e) { const m = /^Registry returned (\\d+)$/.exec(e.message); if (m) { const status = Number(m[1]); if (status === 429 || status >= 500) scheduleRetryWithBackoff(); else logConfigProblem(status); } else throw e; }","preventionTips":["Verify the registry URL resolves to the right package document (404 check)","Respect rate limits and set an identifiable user agent (403/429 avoidance)","Monitor registry status pages for 5xx windows"],"tags":["npm","registry","http","network"],"backgroundTag":"http-error-response","analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-09-08T00:40:44.970Z","contentChangedAt":"2026-09-08T00:40:44.970Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}