Will It Vibe logoWill It Vibe?
FASTAPI-003Medium severity-8 points

Blocking file I/O inside an async route handler

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

The builtin open() performs blocking disk I/O. Inside an async def handler that stalls the event loop for every other in-flight request until the read or write completes.

Why it matters

The builtin open() call performs blocking disk I/O: the OS has to service the read or write before Python gets control back. Inside an async def handler that stalls the event loop for every other in-flight request for as long as the disk operation takes, which is unpredictable under load or on a slow filesystem.

How to fix it

Use an async file library such as aiofiles for reads and writes inside async def handlers, or move the file operation into a thread with await run_in_threadpool(...) (from starlette.concurrency) if switching libraries is not practical. For small, one-time reads at startup (like loading a config file), open() outside a request handler is fine.

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