Lingua-e
← Errors
JavaScript

Promise.all Rejected: What It Means and How to Fix It

Error reference

Promise.all Rejected

Language

JavaScript

Severity

Medium

When it happens

Promise.all() rejects immediately when any one of its input promises rejects, discarding the results of all other promises even if they succeed.

Potential fixes

Use Promise.allSettled() to get the results of all promises regardless of individual failures. Filter the results by status === 'fulfilled' to extract successful values. Use Promise.all() only when you want all-or-nothing semantics.

Deep dive

Promise.all() rejects immediately when any one of its input promises rejects, discarding the results of all other promises even if they succeed. This fail-fast behavior is intentional but can be surprising when you need the results of the successful promises.

Why it happens

  • One of the parallel requests fails while others succeed.
  • A network error, timeout, or non-OK HTTP status causes one promise to reject.
  • An exception thrown inside one of the async operations propagates as a rejection.

Potential fixes

Use Promise.allSettled() to get the results of all promises regardless of individual failures. Filter the results by status === 'fulfilled' to extract successful values. Use Promise.all() only when you want all-or-nothing semantics.

Examples

JavaScript

Code that triggers the error

const results = await Promise.all([
  fetch("/api/users"),
  fetch("/api/missing-endpoint"),  // returns 404, then .json() throws
  fetch("/api/posts"),
]);

Error output

Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE..." is not valid JSON

Fixed code

const results = await Promise.allSettled([
  fetch("/api/users").then(r => r.json()),
  fetch("/api/missing-endpoint").then(r => r.json()),
  fetch("/api/posts").then(r => r.json()),
]);
const succeeded = results
  .filter(r => r.status === "fulfilled")
  .map(r => r.value);

Practice in English

How would you explain a Promise.all Rejected to a fellow dev? Choose the right phrase:

"I hit an error...

Ready to practice your English at work?

Lingua-e has interactive exercises built around real developer conversations: standups, code reviews, retrospectives, and more. Practice until it comes naturally.

Try Lingua-e for free