Async route handler without try/catch
Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.
What it detects
An async Express route handler awaits a promise with no surrounding try/catch. In Express 4 a rejection here is not routed to error middleware, so the request hangs and the rejection goes unhandled. Heuristic.
Why it matters
An async route handler that awaits without a try/catch produces a rejected promise Express 4 never sees, so the error is not routed to your error middleware and the request hangs until it times out. It also surfaces as an unhandledRejection, which can crash the process depending on your Node settings. This is a heuristic that reads the handler body, so wrapped handlers may be flagged even when they are safe.
How to fix it
Wrap the awaited work in try/catch and forward failures with next(err), or wrap handlers in an async error adapter (a small higher-order function, or the express-async-errors package) so rejections reach your error middleware. On Express 5 this is handled automatically. Make sure a central error handler exists to receive the forwarded errors.
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