npm / p-retry
p-retry
What changed in p-retry 4 to 9, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
15 breaking1 security2 new APIs and options1 behavior and defaults1 tooling12 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initp-retry 915 changes
Breaking changes 6
The
randomizeoption must be a boolean; other values throw aTypeError.The
signaloption must be anAbortSignal; other values throw aTypeError.The
unrefoption must be a boolean; other values throw aTypeError.Delays above 2147483647ms are capped at that value instead of firing immediately.
Returning nothing now counts as
true, so a callback that omits a return no longer bypasses the retries budget.Once aborted, the signal's reason always rejects the promise, and no more callbacks are called.
Behavior and default changes 1
The
messageargument is now optional.
Fixes and other changes 8
A nested
AbortErrorno longer escapes instead of its cause.The wrapped error now has the correct message and its stack starts at the caller instead of inside p-retry.
A thrown value that cannot be stringified no longer replaces the real failure.
The function passed to
makeRetriablenow retains itsthistype.Options can now be explicitly passed as
undefinedwhen usingexactOptionalPropertyTypes.Fixes a
NaNretry delay whenminTimeoutis0andfactorgrows toInfinity.Reports
retryDelay: 0for aTypeErrorthat is never retried.The callback is also called when
maxRetryTimehas run out, preserving the documented callback order.
p-retry 86 changes
Breaking changes 2
Node.js 22 is now required to use p-retry.
Callbacks now run in the order shouldConsumeRetry, onFailedAttempt, then shouldRetry; consumption decisions precede failure notifications and retry decisions.
Security 1
Retry timing and callback validation were hardened.
New APIs and options 1
The onFailedAttempt context now includes retryDelay, making the retry delay available to the callback.
Fixes and other changes 2
Fixes an error related to invalid fractional retry counts.
TypeError retry handling was fixed.
p-retry 75 changes
Breaking changes 3
The forever option was removed; use {retries: Infinity} for infinite retries.
Node.js 20 is now required to run p-retry.
The callback now receives a context object instead of a decorated error; access the error as object.error. attemptNumber and retriesLeft are unchanged.
New APIs and options 1
A makeRetriable method was added.
Fixes and other changes 1
Fixes delayed abort when the signal is already aborted before the delay phase.
p-retry 62 changes
Breaking changes 1
Node.js 16 is now required.
Fixes and other changes 1
The abort handler is correctly removed when done.
p-retry 52 changes
Breaking changes 2
The minimum required Node.js version is now 12.20.
The package is now pure ESM, which changes how developers import and use it.
p-retry 42 changes
Breaking changes 1
Throwing a non-error now produces a useful error.
Tooling 1
A TypeScript definition is now included for developers using p-retry with TypeScript.