abhigyanpatwari/GitNexus · error · Error

LLM API error ( after retries)

Error message

LLM API error (${err.response.status} after retries): ${errorText.slice(0, 500)}

What it means

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.

Solutions

  1. Read the embedded provider error text — it names the real cause (quota, model name, region, capacity)
  2. For 429/quota: wait or increase limits, and lower `--concurrency`
  3. Retry the run once the provider is healthy; increase `--retries` if the outage is expected to be brief
  4. For self-hosted endpoints check server logs/resources; for 5xx from a proxy verify routing to the model backend

Example fix

# before
gitnexus wiki   # 'LLM API error (429 after retries): rate limit exceeded'

# after
gitnexus wiki --concurrency 1 --retries 5
Defensive patterns

Strategy: retry

Try / catch

try {
  await callLLM(prompt, config);
} catch (err) {
  const msg = err instanceof Error ? err.message : '';
  if (msg.includes('after retries')) {
    const status = Number(msg.match(/\((\d+) after retries\)/)?.[1] ?? 0);
    if (status === 429 || status >= 500) return retryWithBackoff(() => callLLM(prompt, config));
  }
  throw err; // 4xx (except 429) will not heal — surface it
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20). Data as JSON: /api/errors/c7ab6fc53b766880. Report an issue: GitHub.

Appendix: source

Thrown at gitnexus/src/core/wiki/llm-client.ts:419

        signal:
          config.requestTimeoutMs !== undefined
            ? AbortSignal.timeout(config.requestTimeoutMs)
            : undefined,
      },
      {
        breakerKey: `wiki-llm-${new URL(url).host}`,
        retry: { maxAttempts: config.maxAttempts ?? 3, baseDelayMs: 2_000, capDelayMs: 30_000 },
      },
    );
  } catch (err) {
    if (err instanceof CircuitOpenError) {
      throw new Error(
        `LLM endpoint circuit open: retry in ${Math.ceil(err.retryAfterMs / 1000)}s. ${err.message}`,
      );
    }
    if (err instanceof ResilientFetchExhaustedError) {
      const errorText = await err.response.text().catch(() => 'unknown error');
      throw new Error(
        `LLM API error (${err.response.status} after retries): ${errorText.slice(0, 500)}`,
      );
    }
    if (config.requestTimeoutMs !== undefined && isTimeoutLikeError(err)) {
      throw new Error(
        `LLM request timed out after ${formatTimeoutDuration(config.requestTimeoutMs)}. ` +
          'Increase --timeout or omit it to disable the request timeout.',
      );
    }
    throw err;
  }

  if (!response.ok) {
    const errorText = await response.text().catch(() => 'unknown error');

    // Azure content filter — surface a clear message instead of a generic API error.
    if (
      azure &&

View on GitHub (pinned to 52924ef12c)