{"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":420,"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":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/wiki/llm-client.ts#L402-L438","documentation":"Thrown when callLLM() set config.requestTimeoutMs (via --timeout) and the AbortSignal.timeout fired before the provider responded, and the resulting error matches isTimeoutLikeError(). The message names the elapsed duration (formatTimeoutDuration) and tells you the timeout is opt-in. By default no timeout is imposed because large local-model runs legitimately take minutes.","triggerScenarios":"Calling callLLM() with config.requestTimeoutMs=60000 against a slow endpoint (large prompt, reasoning model, or busy local server) where the response takes longer than 60s; the AbortSignal aborts the fetch and the rejection is recognized as a timeout.","commonSituations":"Setting --timeout 60 for wiki generation against a large-context model; running a local LLM (Ollama/LM Studio) that generates slowly; rate-limited shared endpoints that queue requests; reasoning models (o1/o3) that think for tens of seconds.","solutions":["Increase --timeout (e.g. --timeout 300) to match the model's realistic latency.","Omit --timeout entirely to disable the ceiling (the default path).","Reduce prompt size or split the work into smaller calls.","Use a faster/non-reasoning model for the bulk pass.","For local servers, raise the server's own inference budget / batch size."],"exampleFix":"# before\ngitnexus wiki --llm-base-url http://localhost:11434/v1 --timeout 60\n# times out on long generations\n\n# after\ngitnexus wiki --llm-base-url http://localhost:11434/v1 --timeout 600\ngitnexus wiki --llm-base-url http://localhost:11434/v1   # omit to disable","handlingStrategy":"validation","validationCode":"// Don't set requestTimeoutMs unless you know the latency profile.\n// If you do, size it to p99 generation time:\nconst estimated = expectedOutputTokens * msPerToken * 1.5;\nconfig.requestTimeoutMs = Math.max(60_000, estimated);","typeGuard":"function isLLMTimeoutError(e) {\n  return e instanceof Error && /LLM request timed out after/.test(e.message);\n}","tryCatchPattern":"try { return await callLLM(prompt, config); }\ncatch (e) {\n  if (isLLMTimeoutError(e)) {\n    config = { ...config, requestTimeoutMs: (config.requestTimeoutMs ?? 60_000) * 2 };\n    return await callLLM(prompt, config);\n  }\n  throw e;\n}","preventionTips":["Omit --timeout for local/large models (no ceiling is the safe default).","When you do set a timeout, base it on measured p99 generation latency, not a guess.","Reduce prompt size or use a faster model rather than ratcheting the timeout up indefinitely."],"tags":["llm","timeout","configuration","network","wiki"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}