{"record":{"id":"1299c90a0d297445","repo":"abhigyanpatwari/GitNexus","slug":"llm-request-timed-out-after-formattimeoutduratio","errorCode":null,"errorMessage":"LLM request timed out after ${formatTimeoutDuration(config.requestTimeoutMs)}. Increase --timeout or omit it to disable the request timeout.","messagePattern":"LLM request timed out after (.+?)\\. Increase --timeout or omit it to disable the request timeout\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/wiki/llm-client.ts","lineNumber":424,"sourceCode":"      {\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 &&\n      response.status === 400 &&\n      (errorText.includes('content_filter') || errorText.includes('ResponsibleAIPolicyViolation'))\n    ) {\n      throw new Error(\n        `Azure content filter blocked this request. The prompt triggered content policy. Details: ${errorText.slice(0, 300)}`,","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/core/wiki/llm-client.ts#L406-L442","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Increase the limit: `--timeout 300` (seconds)","Or omit `--timeout` entirely — the default disables the request timeout","For local models, use a smaller model or GPU inference to cut latency"],"exampleFix":"# before\ngitnexus wiki --timeout 30   # reasoning model exceeds 30s\n\n# after\ngitnexus wiki --timeout 300","handlingStrategy":"validation","validationCode":"// Verify the timeout can plausibly fit the model before the run:\nif (config.requestTimeoutMs !== undefined && config.requestTimeoutMs < 60_000 && config.reasoningModel) {\n  throw new Error('Timeout < 60s is too tight for reasoning models');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await callLLM(prompt, config);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('LLM request timed out after')) {\n    return callLLM(prompt, { ...config, requestTimeoutMs: config.requestTimeoutMs! * 2 });\n  }\n  throw err;\n}","preventionTips":["Omit --timeout unless you truly need a bound; the default disables it","For reasoning models or CPU-only local inference, budget minutes per request, not seconds","Scale timeout with --concurrency: parallel slow requests contend for bandwidth"],"tags":["llm","timeout","configuration","network","gitnexus"],"backgroundTag":"request-timeout","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"}