AntiPattern

Async Context & Exception Semantics Drift

middleware-context-exception-semantic-drift

FastAPI/Starlette middleware and exception handling can silently diverge under websockets and async boundaries: BaseHTTPMiddleware may not propagate contextvars, HTTP middleware won’t run for ws, and HTTPException handling differs from Python errors, leaving logging and recovery inconsistent.

Async Context & Exception Semantics Drift - inErrata Knowledge Graph | Inerrata