Most JavaScript async await mistakes don’t crash anything. That’s the problem. The code runs, the tests pass, and three weeks later someone notices half the records never got saved, or that a page takes 650 ms to load when it should take 200.
We wrote a small script for each of the ten mistakes below and ran every one on Node.js v24.22.1 (Windows 10). The outputs you see are copied straight from the terminal. The rules behind them come from MDN and the Node.js docs, linked in each section.
Quick answer: The most common JavaScript async await mistakes are forgetting await, using await inside forEach, running independent calls one after another, returning a promise from try without awaiting it, trusting fetch to throw on 404, and leaving rejections unhandled. Each one has a short, reliable fix shown below.
- An async function always returns a promise, even when you
returna plain object. forEachandfilterignore promises. Usefor...oforPromise.all.- Three independent 200 ms calls took about 650 ms in sequence and about 210 ms with
Promise.allin our runs. - An unhandled rejection stops a Node.js process with exit code 1 by default.
How async and await work in JavaScript
A quick refresher, because every mistake on this list comes from forgetting one of these rules. According to MDN’s page on the async function, an async function always returns a promise. If it returns a value, the promise resolves with that value. If it throws, the promise rejects.
The await operator pauses only the async function it sits in. The rest of your program keeps going. Code that calls the function without awaiting it doesn’t wait for anything.
Keep those two rules in your head and most of what follows will feel obvious in hindsight.
1. Forgetting await
The classic. You call an async function, forget the await, and get a promise instead of the data.
async function getUser() { return { name: "Ada" }; }
function bad() {
const user = getUser();
console.log(user); // Promise { { name: 'Ada' } }
console.log(user.name); // undefined
}
async function good() {
const user = await getUser();
console.log(user.name); // Ada
}
Note that user.name gives undefined, not an error. Nothing tells you something went wrong. TypeScript catches many of these, since a promise has no name property. The typescript-eslint rule no-floating-promises also flags promises you create and never handle.
2. Using await outside an async function
This one at least fails loudly. Put await inside a regular function in a CommonJS file and Node refuses to run it:
SyntaxError: await is only valid in async functions and the top level bodies of modules
The message says it all. Either mark the function async, or, if you want top-level await, use an ES module (a .mjs file, or "type": "module" in package.json). Our fetch example further down uses top-level await in a .mjs file for exactly this reason.
3. Using await inside forEach
This is the bug behind a lot of “but I awaited it!” posts on Stack Overflow. MDN’s forEach page is blunt about it: forEach expects a synchronous function and does not wait for promises.
async function saveAll(items) {
items.forEach(async (item) => {
await wait(50);
console.log("saved", item);
});
console.log("forEach: done?");
}
// Output:
// forEach: done?
// saved 1
// saved 2
“Done” prints before anything is saved. If the caller closes a database connection after saveAll returns, those writes fail.
The fix depends on what you want. For one-at-a-time processing, use for...of:
for (const item of items) {
await wait(50);
console.log("saved", item);
}
console.log("for...of: done"); // prints last, as expected
For parallel work, map to promises and pass them to Promise.all, which brings us to the next mistake.
4. Awaiting independent calls one by one
When three requests don’t depend on each other, awaiting them in a row makes each one wait for the last. We timed it with three fake tasks that each take 200 ms:

// Sequential: about 650 ms
await task(200); await task(200); await task(200);
// Parallel: about 210 ms
await Promise.all([task(200), task(200), task(200)]);
Across three runs on our machine (an older Intel Core i5-4310U laptop), the sequential version took 673, 655 and 651 ms. Promise.all took 213, 210 and 217 ms. That’s roughly a third of the time, which is what you’d expect from three equal tasks running together.
Don’t parallelize everything blindly, though. If call B needs the result of call A, it has to wait. And firing 500 requests at once at someone’s API can get you rate-limited. For big batches, process in chunks of 10 or 20.
5. Using Promise.all when one failure shouldn’t sink all
Promise.all rejects as soon as any promise rejects. You lose the results of the ones that worked. If you’re loading three dashboard widgets and one API is down, you probably still want the other two.
try {
await Promise.all([ok("a"), fail("b broke"), ok("c")]);
} catch (e) {
console.log("Promise.all threw:", e.message); // b broke
}
const results = await Promise.allSettled([ok("a"), fail("b broke"), ok("c")]);
console.log(results.map((r) => r.status));
// [ 'fulfilled', 'rejected', 'fulfilled' ]
Promise.allSettled waits for everything and tells you which ones worked. Use all when the tasks only make sense together, and allSettled when partial results are fine.
6. Returning a promise from try without await
This one fools experienced developers, partly because some linters used to warn against return await. Look at these two functions:
async function withoutAwait() {
try { return fail(); } catch { return "fallback"; }
}
async function withAwait() {
try { return await fail(); } catch { return "fallback"; }
}
// Output:
// withAwait: fallback
// withoutAwait rejected: db down
Without await, the function hands the promise back before it rejects, so the catch block never sees the error. The caller gets “db down” even though you wrote a fallback. Inside try, always write return await. Outside a try block it makes no practical difference.
7. Expecting fetch to throw on a 404
Good async await error handling in JavaScript also means knowing what counts as an error. For fetch(), MDN explains that the promise only rejects on network failures, not on HTTP error codes. We started a tiny local server that always answers 404 and fetched from it:
const res = await fetch(url);
console.log("no error thrown, status:", res.status, "ok:", res.ok);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
// Output:
// no error thrown, status: 404 ok: false
// caught: HTTP 404
Your try/catch around fetch won’t fire on a 404 or a 500. Check res.ok yourself, every time. A small wrapper function that does this check is worth adding to any project that calls APIs.
8. Passing an async callback to filter
Same root cause as forEach, sneakier result. filter checks whether the callback’s return value is truthy. An async callback returns a promise, and every promise is truthy.
const wrong = users.filter(async (u) => await isAdmin(u));
console.log(wrong.length); // 3 (all users kept)
const flags = await Promise.all(users.map(isAdmin));
const admins = users.filter((_, i) => flags[i]);
console.log(admins.length); // 1
With three users and one admin, the async filter kept all three. Picture that in a permission check. The fix is to resolve the checks first with Promise.all, then filter with the plain boolean results. The same trap applies to some, every and find.
9. Leaving rejections unhandled
Calling an async function without await or .catch() is sometimes called fire-and-forget. If it rejects, Node.js doesn’t just log a warning anymore. The –unhandled-rejections setting defaults to throw, so the process stops.
async function sendEmail() { throw new Error("SMTP timeout"); }
sendEmail();
setTimeout(() => console.log("this line never runs"), 100);
// Error: SMTP timeout
// Node.js v24.22.1
// (exit code 1)
The timer never printed. In a server, that’s a crash and restart over one failed email. If you really don’t need to wait, still attach a handler: sendEmail().catch(logError).
10. Thinking async makes heavy code non-blocking
Adding async to a function doesn’t move it to another thread. The body runs right away, on the main thread, until it hits the first await. A loop that adds up 300 million numbers blocks everything else while it runs.
setTimeout(() => console.log("timer wanted 10 ms, ran after", elapsed(), "ms"), 10);
async function heavy() {
let x = 0;
for (let i = 0; i < 3e8; i++) x += i;
return x;
}
heavy().then(() => console.log("heavy done"));
// heavy done
// timer wanted 10 ms, ran after 1176 ms
A 10 ms timer fired after more than a second in every run we did (1,176 ms in the run above, longer when the PC was busy). In a web server, every other request would be stuck behind that loop too. For real CPU work, use worker threads in Node or Web Workers in the browser, or split the job into small chunks.
The part most lists skip: seven of these ten mistakes give no error at all. Mistakes 1, 3, 4, 5, 6, 7 and 8 all ran with exit code 0 and simply printed the wrong thing, skipped a fallback or ran slower. So “it didn’t throw” proves nothing with async code. Linters catch some of them, and a test that checks the actual saved data or the timing catches the rest.
Await vs then: does it matter?
People often ask whether they should use await or .then(). Both work with the same promises, so it’s mostly about readability. await with try/catch reads top to bottom and is easier for most teams. Mixing both styles in one function is where bugs creep in, because it’s easy to lose track of which promise is being returned. Pick one per function.
If you’re stuck on an async bug right now, our guide on how to fix bugs with AI without hiding the real bug shows how to give an assistant enough context to spot things like a missing await.
Fix these JavaScript async await mistakes first

If you only change three habits, make it these. Check res.ok after every fetch. Never pass an async callback to forEach, filter or friends. And write return await inside every try block. Those three cover the bugs that cause wrong data rather than just slow pages.
After that, look for sequential awaits you can group with Promise.all. It’s often the cheapest speed win in a codebase.
Next: for shorter wins, see 20 JavaScript one-liners tested in Node 24, or start from our Python tricks for beginners hub if you write both languages. Moving to TypeScript? Our TypeScript tips for beginners show which bugs the type checker catches before you run anything, and which it misses.
FAQ
Why use async await in JavaScript?
It lets you write promise-based code that reads like normal step-by-step code, with ordinary try/catch for errors. It doesn’t make code faster on its own. It just makes waiting for network, file or database work easier to read.
When should you not use await?
Skip an immediate await when you want several independent tasks to start together. Start them first, then await Promise.all or Promise.allSettled. Also avoid it inside array methods like forEach and filter.
How do you handle errors with async await?
Wrap the awaited calls in try/catch, use return await inside the try, and check res.ok for fetch. For calls you don’t await, attach .catch() so a rejection can’t crash Node.
Can you use await at the top level?
Yes, in ES modules. Node supports it in .mjs files or when package.json sets "type": "module", and browsers support it in <script type="module">. In a CommonJS file you get the SyntaxError shown in mistake 2.