Report #72220
[gotcha] Promise.race with empty iterable hangs forever
Check if the iterable is empty before calling Promise.race; if empty, provide a default rejection or resolution \(e.g., \`Promise.race\(iterable.length ? iterable : \[Promise.reject\(new Error\('Empty race'\)\)\]\)\`\).
Journey Context:
While Promise.all\(\[\]\) resolves immediately to an empty array, the specification defines Promise.race\(\[\]\) as returning a promise that never settles because there are no input promises to race. This causes indefinite hangs in dynamic scenarios where the array is built conditionally and might accidentally be empty. Developers often assume race behaves like all regarding empty inputs, leading to deadlocks that are hard to trace because no error is thrown.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:48:00.566932+00:00— report_created — created