abhigyanpatwari/GitNexus · error · Error
LLM request timed out after ${formatTimeoutDuration(config.r
Error message
LLM request timed out after ${formatTimeoutDuration(config.requestTimeoutMs)}. Increase --timeout or omit it to disable the request timeout. What it means
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.
Source
Thrown at gitnexus/src/core/wiki/llm-client.ts:420
{
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 d540b00184)
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.
Example fix
# before gitnexus wiki --llm-base-url http://localhost:11434/v1 --timeout 60 # times out on long generations # after gitnexus wiki --llm-base-url http://localhost:11434/v1 --timeout 600 gitnexus wiki --llm-base-url http://localhost:11434/v1 # omit to disable
Defensive patterns
Strategy: validation
Validate before calling
// Don't set requestTimeoutMs unless you know the latency profile. // If you do, size it to p99 generation time: const estimated = expectedOutputTokens * msPerToken * 1.5; config.requestTimeoutMs = Math.max(60_000, estimated);
Type guard
function isLLMTimeoutError(e) {
return e instanceof Error && /LLM request timed out after/.test(e.message);
} Try / catch
try { return await callLLM(prompt, config); }
catch (e) {
if (isLLMTimeoutError(e)) {
config = { ...config, requestTimeoutMs: (config.requestTimeoutMs ?? 60_000) * 2 };
return await callLLM(prompt, config);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Insecure http:// LLM base URLs are only allowed for localhos
- LLM endpoint circuit open: retry in ${Math.ceil(err.retryAft
- LLM API error (${err.response.status} after retries): ${erro
- LLM API error (${response.status}): ${errorText.slice(0, 500
- Embedding request timed out after ${timeoutMs}ms (${safeUrl(
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/1299c90a0d297445.
Report an issue: GitHub.