Report #10859
[gotcha] Array.prototype.forEach does not await async callbacks
Replace forEach with for...of loops for sequential async operations, or Promise.all\(array.map\(async ...\)\) for parallel execution. Never mix forEach with async/await.
Journey Context:
forEach returns undefined and fires callbacks synchronously, creating 'floating' Promises that are not awaited by the outer scope. This causes race conditions where the loop exits before async work completes, or errors are silently swallowed. Developers confuse it with map because both take callbacks. for...of provides sequential guarantees and proper error stack traces but is slower; Promise.all with map runs concurrently \(faster\) but requires careful error handling \(use Promise.allSettled if partial failure is acceptable\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:49:36.937285+00:00— report_created — created