{"record":{"id":"5520fd9db04cbc72","repo":"headroomlabs-ai/headroom","slug":"failed-after-maxattempts-attempts-lasterror","errorCode":null,"errorMessage":"Failed after ${maxAttempts} attempts: ${lastError}","messagePattern":"Failed after (.+?) attempts: (.+?)","errorType":"exception","errorClass":"HeadroomConnectionError","httpStatus":null,"severity":"error","filePath":"sdk/typescript/src/client.ts","lineNumber":264,"sourceCode":"        return await this._doCompress(messages, model, options.tokenBudget);\n      } catch (error) {\n        lastError = error;\n        if (error instanceof HeadroomAuthError) throw error;\n        if (\n          error instanceof HeadroomCompressError &&\n          error.statusCode < 500\n        ) {\n          throw error;\n        }\n      }\n    }\n\n    if (this.fallback) {\n      return makeFallbackResult(messages);\n    }\n    if (lastError instanceof HeadroomConnectionError) throw lastError;\n    if (lastError instanceof HeadroomCompressError) throw lastError;\n    throw new HeadroomConnectionError(\n      `Failed after ${maxAttempts} attempts: ${lastError}`,\n    );\n  }\n\n  /**\n   * Raw compress call — sends body directly to /v1/compress.\n   * Used by simulate() and other advanced features.\n   * @internal\n   */\n  async compressRaw(body: Record<string, any>): Promise<any> {\n    const response = await this._fetch(\"/v1/compress\", {\n      method: \"POST\",\n      body: JSON.stringify(body),\n    });\n    return response.json();\n  }\n\n  // ============================================================","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/headroomlabs-ai/headroom/blob/322425c43bffde1ed0b64fecf3cf5951565dd82b/sdk/typescript/src/client.ts#L246-L282","documentation":"Error \"Failed after ${maxAttempts} attempts: ${lastError}\" thrown in headroomlabs-ai/headroom.","triggerScenarios":"Raised by the TypeScript client after exhausting all retry attempts for a request, surfacing the last encountered error.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"322425c43bffde1ed0b64fecf3cf5951565dd82b","analyzedAt":"2026-08-15T01:03:05.481Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}