{"record":{"id":"c7ab6fc53b766880","repo":"abhigyanpatwari/GitNexus","slug":"llm-api-error-err-response-status-after-retrie","errorCode":null,"errorMessage":"LLM API error (${err.response.status} after retries): ${errorText.slice(0, 500)}","messagePattern":"LLM API error \\((.+?) after retries\\): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/wiki/llm-client.ts","lineNumber":419,"sourceCode":"        signal:\n          config.requestTimeoutMs !== undefined\n            ? AbortSignal.timeout(config.requestTimeoutMs)\n            : undefined,\n      },\n      {\n        breakerKey: `wiki-llm-${new URL(url).host}`,\n        retry: { maxAttempts: config.maxAttempts ?? 3, baseDelayMs: 2_000, capDelayMs: 30_000 },\n      },\n    );\n  } catch (err) {\n    if (err instanceof CircuitOpenError) {\n      throw new Error(\n        `LLM endpoint circuit open: retry in ${Math.ceil(err.retryAfterMs / 1000)}s. ${err.message}`,\n      );\n    }\n    if (err instanceof ResilientFetchExhaustedError) {\n      const errorText = await err.response.text().catch(() => 'unknown error');\n      throw new Error(\n        `LLM API error (${err.response.status} after retries): ${errorText.slice(0, 500)}`,\n      );\n    }\n    if (config.requestTimeoutMs !== undefined && isTimeoutLikeError(err)) {\n      throw new Error(\n        `LLM request timed out after ${formatTimeoutDuration(config.requestTimeoutMs)}. ` +\n          'Increase --timeout or omit it to disable the request timeout.',\n      );\n    }\n    throw err;\n  }\n\n  if (!response.ok) {\n    const errorText = await response.text().catch(() => 'unknown error');\n\n    // Azure content filter — surface a clear message instead of a generic API error.\n    if (\n      azure &&","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/core/wiki/llm-client.ts#L401-L437","documentation":"resilientFetch exhausted its retry budget (maxAttempts, default 3, configurable via `--retries`) and the last attempt still returned an HTTP error response (5xx/429 or other retriable status). The message includes the response status and the first 500 characters of the error body so you can see the provider's own error text. This is a terminal failure for that one LLM call after retries, not a circuit-breaker rejection.","triggerScenarios":"Provider returns persistent 500/502/503/504 or 429 across all retry attempts (2s base delay, capped at 30s); auth-quota errors that surface as retriable statuses; upstream gateway down for the full retry window.","commonSituations":"LLM provider outage or maintenance; free-tier quota exhausted returning 429 on every attempt; self-hosted server OOM-ing; retries all hitting the same broken node.","solutions":["Read the embedded provider error text — it names the real cause (quota, model name, region, capacity)","For 429/quota: wait or increase limits, and lower `--concurrency`","Retry the run once the provider is healthy; increase `--retries` if the outage is expected to be brief","For self-hosted endpoints check server logs/resources; for 5xx from a proxy verify routing to the model backend"],"exampleFix":"# before\ngitnexus wiki   # 'LLM API error (429 after retries): rate limit exceeded'\n\n# after\ngitnexus wiki --concurrency 1 --retries 5","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await callLLM(prompt, config);\n} catch (err) {\n  const msg = err instanceof Error ? err.message : '';\n  if (msg.includes('after retries')) {\n    const status = Number(msg.match(/\\((\\d+) after retries\\)/)?.[1] ?? 0);\n    if (status === 429 || status >= 500) return retryWithBackoff(() => callLLM(prompt, config));\n  }\n  throw err; // 4xx (except 429) will not heal — surface it\n}","preventionTips":["Watch the status inside the message: 429/5xx justify another run later; other 4xx need config fixes","Size --retries and --concurrency to your provider's rate limits","Persist partial wiki progress so long runs can resume instead of restarting all LLM calls"],"tags":["llm","api-error","retries-exhausted","rate-limit","network","gitnexus"],"backgroundTag":"api-retries-exhausted","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}