JavaScript retry libraries

Updated Nov 2026

JavaScript retry libraries run a failed operation again after a delay until it succeeds or reaches an attempt limit. Each delay usually grows exponentially, with random jitter that keeps many clients from retrying at the same moment. These libraries let apps and AI agents recover from network errors, rate limits, and brief outages in the APIs they call.

Popularity

retry has the most monthly downloads in this comparison, at 603.0M.

LibraryMonthly downloadsStarsLast releaseLicense
retry
618.4M
1.3KJun 2021MIT
@humanwhocodes/retry
607.8M
Not on GitHubMay 2025Apache-2.0
Async
559.9M
Not on GitHubAug 2024MIT
es-toolkit
320.3M
Not on GitHubNov 2026MIT
p-retry
276.5M
1.0KNov 2026MIT
exponential-backoff
218.7M
Not on GitHubOct 2025Apache-2.0
async-retry
190.2M
1.9KAug 2021MIT
promise-retry
136.7M
Not on GitHubJun 2020MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Features compared

LibraryNative AbortSignalConfigurable jitterShared retry queue
retryUnsupportedBuilt-inUnsupported
@humanwhocodes/retryBuilt-inUnsupportedBuilt-in
AsyncUnsupportedUnsupportedUnsupported
es-toolkitBuilt-inUnsupportedUnsupported
p-retryBuilt-inBuilt-inUnsupported
exponential-backoffUnsupportedBuilt-inUnsupported
async-retryUnsupportedBuilt-inUnsupported
promise-retryUnsupportedBuilt-inUnsupported
Built-inNot supported

Libraries and code examples

Provides callback-oriented retry operations with configurable backoff and explicit attempt control.

Downloads / mo
618.4M
Stars
1.3K
Last release
0.13.1
License
MIT

Strengths

  • Exposes explicit attempt control. Use attempt, retry, and stop to control callback operations.
  • Supports custom delay schedules. Pass an array of timeouts when exponential backoff does not fit.

Limitations

  • Callbacks must request another attempt. Call operation.retry(error) to schedule the next attempt.
  • Reports the most frequent error. mainError selects the most frequent message rather than the last failure.

Quickstart

From README.md
$ npm install retry@0.13.1
import retry from 'retry';

const operation = retry.operation({ retries: 2 });
operation.attempt(attempt => {
  const error = attempt < 2 ? new Error('Not ready') : null;
  if (operation.retry(error)) return;
  console.log(error ?? 'ready');
});

retry examples

From open-source projects on GitHub

@humanwhocodes/retry

Retries selected failures through a shared Retrier queue.

Downloads / mo
607.8M
Last release
0.4.3
License
Apache-2.0

Quickstart

From README.md
$ npm install @humanwhocodes/retry@0.4.3
import { Retrier } from '@humanwhocodes/retry';

const retrier = new Retrier(error => error.code === 'EMFILE');
const value = await retrier.retry(async () => 'ready');

@humanwhocodes/retry examples

From open-source projects on GitHub

Provides a control-flow toolkit with a built-in retry function.

Downloads / mo
559.9M
Last release
3.2.6
License
MIT

Quickstart

From README.md
$ npm install async@3.2.6
import async from 'async';

const value = await async.retry({ times: 3 }, async () => 'ready');

Async examples

From open-source projects on GitHub

Provides a utility toolkit with a built-in promise retry function.

Downloads / mo
320.3M
Last release
1.53.2
License
MIT

Quickstart

From README.md
$ npm install es-toolkit@1.53.2
import { retry } from 'es-toolkit';

const value = await retry(async () => 'ready', { retries: 2 });

es-toolkit examples

From open-source projects on GitHub

Retries promise-returning operations with backoff, retry budgets, and cancellation signals.

Downloads / mo
276.5M
Stars
1.0K
Last release
9.0.0
License
MIT

Strengths

  • Separates failures from retry budgets. Use shouldConsumeRetry when selected failures should preserve the retry budget.
  • Accepts cancellation signals. Pass an AbortSignal to stop retrying.

Limitations

  • Cancellation leaves running attempts active. Pass the signal into the operation to cancel its underlying work.
  • Time limits allow running overruns. Attempts and callbacks can finish after maxRetryTime.

Quickstart

From readme.md
$ npm install p-retry@9.0.0
import pRetry, {AbortError} from 'p-retry';

const run = async () => {
	const response = await fetch('https://sindresorhus.com/unicorn');

	// Abort retrying if the resource doesn't exist
	if (response.status === 404) {
		throw new AbortError(response.statusText);
	}

	return response.blob();
};

console.log(await pRetry(run, {retries: 5}));

p-retry examples

From open-source projects on GitHub

exponential-backoff

Retries promises with an explicit attempt count, exponential delay bounds, and jitter.

Downloads / mo
218.7M
Last release
3.1.3
License
Apache-2.0

Quickstart

From README.md
$ npm install exponential-backoff@3.1.3
import { backOff } from 'exponential-backoff';

const value = await backOff(async () => 'ready', { numOfAttempts: 3 });

Retries async callbacks with a bail function and node-retry timing options.

Downloads / mo
190.2M
Stars
1.9K
Last release
1.3.3
License
MIT

Strengths

  • Provides an explicit bailout callback. Call bail for failures that should stop retrying.
  • Supports randomized backoff. Configure exponential delays and randomized timeouts through the retry options.

Limitations

  • Bail leaves callback execution active. Return after bail to prevent the callback from continuing.

Quickstart

From README.md
$ npm install async-retry@1.3.3
import retry from 'async-retry';

const value = await retry(async () => 'ready', { retries: 2 });

async-retry examples

From open-source projects on GitHub

Retries promises through an explicit retry callback with the attempt number.

Downloads / mo
136.7M
Last release
2.0.1
License
MIT

Quickstart

From README.md
$ npm install promise-retry@2.0.1
import promiseRetry from 'promise-retry';

const value = await promiseRetry(async () => 'ready', { retries: 2 });

promise-retry examples

From open-source projects on GitHub

FAQ

p-retry suits promise-returning functions that need backoff, jitter, and AbortSignal cancellation. exponential-backoff suits code that wants explicit delay bounds and jitter settings. Projects that already use es-toolkit or Async can use their built-in retry functions.

Exponential backoff multiplies the wait before each retry by a constant factor. A maximum delay caps the growth, and jitter randomizes each wait.

p-retry retries a promise-returning function with configurable randomized backoff. An AbortError or AbortSignal stops the retries early.

p-retry supports AbortSignal and error-aware hooks. async-retry passes a bail function to the task and uses the timing options of the retry package.

For coding agents

Found your retry library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official