IntentiAI

Async call with no await

An async call whose result, and whose failure, is dropped.

Check unawaited-asyncShip CheckTypeScript, JavaScript, Python

Why it matters

Dropping an await is an easy edit to make while moving code around, and agents do it when they refactor a handler or add a side effect such as an audit log or an email. The code still compiles, and in a quick test the call usually finishes in time.

Without the await, nothing waits for the work and nothing catches its failure. If it rejects there is no error response and no stack trace, and on Node an unhandled rejection can stop the process. If the handler returns first, the response reports success for a write that may never land. In Python, a coroutine called without await never runs at all.

Example

 export async function POST(req: Request) {
   const order = await createOrder(await req.json());
-  await prisma.auditLog.create({ data: { orderId: order.id } });
+  prisma.auditLog.create({ data: { orderId: order.id } });
-  await mailer.send(receiptFor(order));
+  mailer.send(receiptFor(order));
   return Response.json(order);
 }

What it detects

  • JavaScript and TypeScript statements that call a function declared async in the same file, or a method such as fetch, .save, .create, .update, .delete, .send, .query, .execute, .commit or .json, with no await, return, void, then, catch or finally, inside an async context.
  • Python coroutines from an async def visible in the file called without await, and asyncio.create_task results that are not kept.
  • Receivers whose methods are synchronous (res, response, socket, stream, logger and similar), event calls such as emit and on, Map and Set .delete, and calls inside argument lists or comprehensions are skipped.
  • Lines marked with no-floating-promises or RUF006 are respected. Confidence is high only when the async definition is visible in the changed file.

What to do when it fires

Put await in front of the call. If it is meant to run in the background, make that explicit with void and attach a .catch() that logs, so a failure cannot pass unnoticed.

In Python, await the coroutine, or keep the task returned by asyncio.create_task in a collection that outlives the call and await or cancel it at shutdown.

Async call with no await: AI code review check | IntentiAI