abhigyanpatwari/GitNexus · error · Error

LLM request timed out after

Error message

LLM request timed out after ${formatTimeoutDuration(config.requestTimeoutMs)}. Increase --timeout or omit it to disable the request timeout.

What it means

A request timeout was configured (requestTimeoutMs from `--timeout <seconds>`, default disabled) and the fetch failed with a timeout-like error (TimeoutError/AbortError or a message matching /time(d)?\s*out|timeout/i — this includes the provider's own 'request timed out' text). The message states the configured duration and how to change it.

Solutions

  1. Increase the limit: `--timeout 300` (seconds)
  2. Or omit `--timeout` entirely — the default disables the request timeout
  3. For local models, use a smaller model or GPU inference to cut latency

Example fix

# before
gitnexus wiki --timeout 30   # reasoning model exceeds 30s

# after
gitnexus wiki --timeout 300
Defensive patterns

Strategy: validation

Validate before calling

// Verify the timeout can plausibly fit the model before the run:
if (config.requestTimeoutMs !== undefined && config.requestTimeoutMs < 60_000 && config.reasoningModel) {
  throw new Error('Timeout < 60s is too tight for reasoning models');
}

Try / catch

try {
  await callLLM(prompt, config);
} catch (err) {
  if (err instanceof Error && err.message.startsWith('LLM request timed out after')) {
    return callLLM(prompt, { ...config, requestTimeoutMs: config.requestTimeoutMs! * 2 });
  }
  throw err;
}

Prevention

When it happens

Trigger: Passing `--timeout 30` while the model (especially with --reasoning-model or a slow/large prompt) takes longer than 30s per request; AbortSignal.timeout firing; provider responding with a timeout error message within the window.

Common situations: Reasoning models or big-context wiki pages exceeding a conservative timeout; slow self-hosted inference (CPU Ollama) with a copied 30s timeout; network latency spikes on large streaming responses.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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

Appendix: source

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

      {
        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 &&
      response.status === 400 &&
      (errorText.includes('content_filter') || errorText.includes('ResponsibleAIPolicyViolation'))
    ) {
      throw new Error(
        `Azure content filter blocked this request. The prompt triggered content policy. Details: ${errorText.slice(0, 300)}`,

View on GitHub (pinned to 52924ef12c)