earendil-works/pi · error
Codex SSE response headers timed out after ${httpTimeoutMs}m
Error message
Codex SSE response headers timed out after ${httpTimeoutMs}ms What it means
Error "Codex SSE response headers timed out after ${httpTimeoutMs}ms" thrown in earendil-works/pi.
Source
Thrown at packages/ai/src/api/openai-codex-responses.ts:400
for (let attempt = 0; attempt <= maxRetries; attempt++) {
if (options?.signal?.aborted) {
throw new Error("Request was aborted");
}
try {
const headerTimeoutSignal =
httpTimeoutMs !== undefined && httpTimeoutMs > 0 ? AbortSignal.timeout(httpTimeoutMs) : undefined;
const combinedSignal = combineAbortSignals([options?.signal, headerTimeoutSignal]);
try {
response = await (options?.fetch ?? globalThis.fetch)(resolveCodexUrl(model.baseUrl), {
method: "POST",
headers: sseHeaders,
body: sseBody,
signal: combinedSignal.signal,
});
} catch (error) {
if (headerTimeoutSignal?.aborted && !options?.signal?.aborted) {
throw new Error(`Codex SSE response headers timed out after ${httpTimeoutMs}ms`);
}
throw error;
} finally {
combinedSignal.cleanup();
}
await options?.onResponse?.(
{ status: response.status, headers: headersToRecord(response.headers) },
model,
);
if (response.ok) {
break;
}
const errorText = await response.text();
if (attempt < maxRetries && isRetryableError(response.status, errorText)) {
const retryAfterDelayMs = getRetryAfterDelayMs(response.headers);
const delayMs =View on GitHub (pinned to 4af9d21d3b)
Solutions
- Increase httpTimeoutMs, or check network and proxy latency to the SSE endpoint.
When it happens
Trigger: Thrown at packages/ai/src/api/openai-codex-responses.ts:400 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/d8407c5e786e05e6.
Report an issue: GitHub.