{"record":{"id":"c4d65aca4711251b","repo":"continuedev/continue","slug":"failed-to-make-api-call-after-maxtries-retries","errorCode":null,"errorMessage":"Failed to make API call after ${maxTries} retries","messagePattern":"Failed to make API call after (.+?) retries","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/util/withExponentialBackoff.ts","lineNumber":41,"sourceCode":"      ) {\n        const retryAfter = (error as APIError).response?.headers.get(\n          RETRY_AFTER_HEADER,\n        );\n        const delay = retryAfter\n          ? parseInt(retryAfter, 10)\n          : initialDelaySeconds * 2 ** attempt;\n        console.log(\n          `Hit rate limit. Retrying in ${delay} seconds (attempt ${\n            attempt + 1\n          })`,\n        );\n        await new Promise((resolve) => setTimeout(resolve, delay * 1000));\n      } else {\n        throw error; // Re-throw other errors\n      }\n    }\n  }\n  throw new Error(`Failed to make API call after ${maxTries} retries`);\n};\n\nexport { withExponentialBackoff };\n","sourceCodeStart":23,"sourceCodeEnd":45,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/util/withExponentialBackoff.ts#L23-L45","documentation":"Thrown by withExponentialBackoff when the wrapped API call still fails after exhausting all retry attempts (only retryable errors are retried; other errors re-throw immediately). It is a terminal wrapper error meaning the underlying failure persisted across every retry with exponential delay.","triggerScenarios":"Calling withExponentialBackoff(fn, ...) where fn keeps throwing retryable errors (e.g. HTTP 429/500, network timeouts) for all maxTries attempts. The original error is lost; only this generic message surfaces.","commonSituations":"API outage, rate limiting without sufficient backoff, invalid credentials causing repeated 401s being classified retryable, or maxTries set too low for a flaky endpoint.","solutions":["Inspect the underlying service/API the wrapped call hits and fix the root cause (auth, endpoint, payload)","Increase maxTries and/or backoff delay for transient failures like rate limits","Verify your retryable-error classifier inside the wrapper so permanent errors fail fast","Add logging of each retry's error before the final throw"],"exampleFix":"// before\nawait withExponentialBackoff(() => api.call(), 3, 2);\n// after\nawait withExponentialBackoff(() => api.call(), 5, 3); // more tries, longer backoff","handlingStrategy":"retry","validationCode":"// Pre-check endpoint health / auth before wrapping\nif (!(await api.healthCheck())) throw new Error('API unavailable');","typeGuard":null,"tryCatchPattern":"try {\n  await withExponentialBackoff(fn, 5, 2);\n} catch (e) {\n  if (e instanceof Error && e.message.includes('after') && e.message.includes('retries')) {\n    // permanent failure after retries: alert / circuit-break\n  }\n  throw e;\n}","preventionTips":["Classify errors as retryable vs permanent before retrying","Tune maxTries/backoff for the endpoint's rate limits","Log each attempt's underlying error"],"tags":["retry","network","api","exponential-backoff"],"backgroundTag":"api-retry-exhausted","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}