headroomlabs-ai/headroom · error · HeadroomConnectionError
Failed after ${maxAttempts} attempts: ${lastError}
Error message
Failed after ${maxAttempts} attempts: ${lastError} What it means
Error "Failed after ${maxAttempts} attempts: ${lastError}" thrown in headroomlabs-ai/headroom.
Source
Thrown at sdk/typescript/src/client.ts:264
return await this._doCompress(messages, model, options.tokenBudget);
} catch (error) {
lastError = error;
if (error instanceof HeadroomAuthError) throw error;
if (
error instanceof HeadroomCompressError &&
error.statusCode < 500
) {
throw error;
}
}
}
if (this.fallback) {
return makeFallbackResult(messages);
}
if (lastError instanceof HeadroomConnectionError) throw lastError;
if (lastError instanceof HeadroomCompressError) throw lastError;
throw new HeadroomConnectionError(
`Failed after ${maxAttempts} attempts: ${lastError}`,
);
}
/**
* Raw compress call — sends body directly to /v1/compress.
* Used by simulate() and other advanced features.
* @internal
*/
async compressRaw(body: Record<string, any>): Promise<any> {
const response = await this._fetch("/v1/compress", {
method: "POST",
body: JSON.stringify(body),
});
return response.json();
}
// ============================================================View on GitHub (pinned to 322425c43b)
Solutions
- Inspect ${lastError} for the underlying failure (network, HTTP status, timeout)
- Verify the Headroom server is running and reachable
- Increase maxAttempts or the per-attempt timeout if failures are transient
- Check request payload validity — persistent 4xx responses will never succeed on retry
When it happens
Trigger: Raised by the TypeScript client after exhausting all retry attempts for a request, surfacing the last encountered error.
Common situations: See trigger scenarios.
AI-assisted analysis of headroomlabs-ai/headroom@322425c43b (2026-08-15).
Data as JSON: /api/errors/5520fd9db04cbc72.
Report an issue: GitHub.