python
runtime_error
ai_generated
true
RuntimeError: No response returned.
ID: python/starlette-runtimeerror-no-response-returned
80%Fix Rate
84%Confidence
0Evidence
2024-09-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
An ASGI middleware or endpoint returns None instead of a Response, or an exception is swallowed inside a BaseHTTPMiddleware dispatch.
generic中文
ASGI 中间件或端点返回 None 而非 Response,或异常在 BaseHTTPMiddleware 的 dispatch 中被吞掉。
Workarounds
-
93% success
class M(BaseHTTPMiddleware): async def dispatch(self, request, call_next): response = await call_next(request) return response -
90% success
try: response = await call_next(request) except Exception: raise
Dead Ends
Common approaches that don't work:
-
75% fail
Hides the original exception and breaks streaming responses.
-
80% fail
Behavior persists across versions; root cause is the middleware logic.