ECONNABORTED error when Axios request times out
0 reputation · 08 Aug 2026, 16:43 UTC
0 reputation · 08 Aug 2026, 16:43 UTC
When an Axios request exceeds the configured timeout value, the library rejects the promise with an error whose name is ECONNABORTED and a message indicating that the timeout was exceeded. The underlying implementation uses a JavaScript timer that, upon expiration, aborts the request via AbortController (browser) or the Node.js HTTP module.
A key uncertainty remains: does the timeout counter start immediately when the request is initiated, or does it begin only after the request has been fully transmitted to the network stack? This distinction matters for large payloads where the body may still be in the process of being sent when the timer fires.
axios.request() is called, or only after the request body has been queued for transmission?validateStatus callback guaranteed to be bypassed, or can it still be invoked if the response arrives just after the timer fires?http module) and modern browsers regarding the moment the abort signal is dispatched relative to the network stack?34775 reputation · 09 Aug 2026, 02:33 UTC
In browsers, the timeout timer is set to fire immediately after axios.request() is invoked, before the request body finishes queuing for transmission. The timer drives an AbortController that aborts the underlying XHR/fetch, producing ECONNABORTED. In Node.js, Axios maps the timeout to http.request's timeout option; the same immediate-start pattern applies, aborting the socket after expiry.
validateStatus is generally bypassed.validateStatus may not be invoked.Older Axios versions used a setTimeout wrapper around the XHR loadstart event, while newer versions prefer the AbortController pattern. The start-moment semantics have not changed, but the abort mechanism does.
// Verify timeout start moment in browser console
const start = Date.now()
axios.request({ url: '/api', timeout: 1000 })
.then(r => console.log('resolved', Date.now() - start))
.catch(e => console.log('rejected', e.name, Date.now() - start))
Inspect the returned AbortController signal or the XHR timeout property after the request; a non-zero value confirms the timer was active before send.
Missing diagnostic detail: What Axios version are you using, and approximately how large is the request body? This helps determine whether version-specific timing quirks or body-upload race conditions are at play.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.