{"record":{"id":"74c052ba517dace6","repo":"softonic/axios-retry","slug":"econnaborted","errorCode":"ECONNABORTED","errorMessage":"ECONNABORTED","messagePattern":"ECONNABORTED","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/index.ts:116","lineNumber":96,"sourceCode":"  isNetworkError(error: AxiosError): boolean;\n  isRetryableError(error: AxiosError): boolean;\n  isSafeRequestError(error: AxiosError): boolean;\n  isIdempotentRequestError(error: AxiosError): boolean;\n  isNetworkOrIdempotentRequestError(error: AxiosError): boolean;\n  exponentialDelay(retryCount?: number, error?: AxiosError, delayFactor?: number): number;\n  linearDelay(delayFactor?: number): (retryCount: number, error: AxiosError | undefined) => number;\n}\n\ndeclare module 'axios' {\n  export interface AxiosRequestConfig {\n    'axios-retry'?: IAxiosRetryConfigExtended;\n  }\n}\n\nexport const namespace = 'axios-retry';\n\nexport function isNetworkError(error) {\n  const CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];\n  if (error.response) {\n    return false;\n  }\n  if (!error.code) {\n    return false;\n  }\n  // Prevents retrying timed out & cancelled requests\n  if (CODE_EXCLUDE_LIST.includes(error.code)) {\n    return false;\n  }\n  // Prevents retrying unsafe errors\n  return isRetryAllowed(error);\n}\n\nconst SAFE_HTTP_METHODS = ['get', 'head', 'options'];\nconst IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);\n\nexport function isRetryableError(error: AxiosError): boolean {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/softonic/axios-retry/blob/dd9b700dfbe51ba2962e70e7822734e3e74613c8/src/index.ts#L78-L114","documentation":"ECONNABORTED is set by axios when a request fails because its configured timeout elapsed, or the underlying socket/connection was aborted mid-flight (distinct from ECONNREFUSED/ECONNRESET which are refused/reset connections). At src/index.ts:96 axios-retry places 'ECONNABORTED' in CODE_EXCLUDE_LIST inside isNetworkError, so a timed-out request is deliberately NOT classified as a network error and the default retryCondition will not retry it. The inline comment at src/index.ts:103 ('Prevents retrying timed out & cancelled requests') documents this as intended behavior — a timeout is treated as a possibly-slow endpoint rather than a transient blip.","triggerScenarios":"A request whose AxiosRequestConfig.timeout (ms) is exceeded before the server responds, or whose socket is aborted, rejects with AxiosError code === 'ECONNABORTED' and no .response. The response interceptor calls isNetworkOrIdempotentRequestError -> isNetworkError, which returns false at src/index.ts:104 due to the CODE_EXCLUDE_LIST membership, so shouldRetry returns false and the error is rejected at src/index.ts:328 without any retry attempt.","commonSituations":"timeout config set lower than the endpoint's realistic p99 latency; high-latency or mobile networks; server-side processing (heavy query, cold start, large payload) exceeding the client timeout; a gateway/proxy/load-balancer with a shorter timeout than the client; shouldResetTimeout left at false (default) so cumulative retry delays eat the original timeout budget; recent axios 0.x -> 1.x upgrade where timeout semantics around proxies/agents changed.","solutions":["Raise the request timeout to comfortably exceed the endpoint's observed p99 latency (measure first, don't guess).","Set shouldResetTimeout: true in the axios-retry options so each retry attempt gets a fresh full timeout budget instead of sharing the original.","Provide a custom retryCondition that returns true for error.code === 'ECONNABORTED' on idempotent verbs if you specifically want timeouts retried.","Investigate server-side latency or intermediary proxies/LBs if timeouts are chronic — retrying a genuinely slow endpoint just amplifies load.","Check for a custom httpAgent/httpsAgent with its own timeout that is shorter than config.timeout."],"exampleFix":"// before\naxiosRetry(client, { retries: 3 }); // default: timeouts NOT retried\nawait client.get('/slow', { timeout: 2000 }); // -> ECONNABORTED, no retry\n\n// after\naxiosRetry(client, {\n  retries: 3,\n  shouldResetTimeout: true, // fresh budget per attempt\n  retryCondition: (err) =>\n    axiosRetry.isNetworkOrIdempotentRequestError(err) ||\n    (err.code === 'ECONNABORTED' &&\n      ['get', 'head', 'options', 'put', 'delete'].includes(\n        err.config?.method ?? ''\n      )),\n});\nawait client.get('/slow', { timeout: 10000 });","handlingStrategy":"validation","validationCode":"// Validate the timeout is sane relative to observed latency BEFORE sending.\nfunction buildConfig(url, { timeout = 5000 } = {}) {\n  const p99 = latencyP99MsFor(url); // your metrics source\n  if (timeout <= p99) {\n    console.warn(`timeout ${timeout}ms < p99 ${p99}ms for ${url}; raising`);\n    timeout = Math.ceil(p99 * 2);\n  }\n  return { timeout };\n}","typeGuard":"import type { AxiosError } from 'axios';\n\nfunction isTimeoutError(error: unknown): error is AxiosError {\n  return (\n    typeof error === 'object' &&\n    error !== null &&\n    (error as AxiosError).code === 'ECONNABORTED' &&\n    !(error as AxiosError).response\n  );\n}","tryCatchPattern":"try {\n  await client.get('/slow', { timeout: 10000 });\n} catch (err) {\n  if (err?.code === 'ECONNABORTED') {\n    // timeout — surface as a distinct, actionable error to the caller\n    throw new Error(`Request timed out after ${err.config?.timeout}ms`);\n  }\n  throw err;\n}","preventionTips":["Measure p99 latency per endpoint and set timeout to at least 2-3x that.","Set shouldResetTimeout: true whenever you retry, so the budget is per-attempt.","Check any custom httpAgent/httpsAgent for a shorter timeout than config.timeout.","After an axios 0.x -> 1.x upgrade, re-verify timeout behavior under proxies/agents.","Alert on ECONNABORTED rate per endpoint to catch chronic slowness early."],"tags":["network","timeout","axios","retry-configuration"],"analyzedSha":"dd9b700dfbe51ba2962e70e7822734e3e74613c8","analyzedAt":"2026-08-07T04:35:39.629Z","schemaVersion":2},"datasetVersion":"2026-08-07T07:17:06.508Z"}