Skip to main content
Interviewpedia

Why might Promise.all reject while other requests continue running?

Technical · Mid-level

Answer guide

Read the answer guide

Promise.all settles as soon as one promise rejects, giving you that error, but JavaScript has no built-in cancellation, so the other operations already started keep running and their results are ignored. That can waste resources or leave side effects half done. If you need every outcome, for example to report which of several uploads failed, use allSettled and inspect each result. If you want to stop the rest, pass an AbortSignal to the underlying calls and clean up in a finally block. Also remember that Promise.all does not limit concurrency, so launching thousands at once can overload the target.

What the interviewer is assessing

Whether you know Promise.all semantics and can handle failure, cancellation and cleanup of sibling work.

A strong answer covers

  • Promise.all rejects on the first failure, but JavaScript has no built-in cancellation, so other started operations keep running with results ignored.
  • Use allSettled when you need each outcome, for example to report which uploads failed.
  • To stop the rest, pass an AbortSignal to the underlying calls and clean up in a finally block.
  • Orphaned operations can waste resources or leave side effects half done.
  • Promise.all does not limit concurrency, so launching thousands at once can overload the target.

Common mistakes

  • They believe a rejection cancels the other promises, so they leave in-flight work unmanaged.
  • They use Promise.all on every batch, ignoring that partial results are lost when one item fails.

Practise a follow-up

  • How would you limit concurrency to protect a service?
  • When would you choose Promise.race or Promise.any instead?
Practise this question →

Related questions