Will It Vibe logoWill It Vibe?
PERF-002Medium severity-8 points

async callback passed to .forEach()

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.

What it detects

.forEach() never awaits its callback and ignores its return value, so an async callback runs but the outer code does not wait for it and any rejection is unhandled. This is a very common bug: the author almost always wanted sequential awaits (a for...of loop) or concurrent ones (Promise.all with .map).

Why it matters

.forEach() does not look at what its callback returns and never awaits a promise, so an async callback passed to forEach runs, but the outer forEach() call returns immediately without waiting for any of the awaits inside it to finish. Code after the forEach() call executes before the async work is done, and if one of the callbacks rejects, that rejection is unhandled. This is one of the most common real async bugs in JavaScript and TypeScript.

How to fix it

If the iterations must run one after another and the surrounding code needs to wait for all of them, replace forEach with a for...of loop and await inside it. If the iterations are independent and can run concurrently, use array.map(async ...) and await Promise.all(...) on the resulting array of promises.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks