python
runtime_error
ai_generated
true
RuntimeError: No response returned.
ID: python/starlette-streaming-response-generator-error
80%Fix Rate
84%Confidence
0Evidence
2024-09-25First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
A middleware or dependency returns None instead of a Response, or a route forgets to return, so Starlette finds no response to send.
generic中文
中间件或依赖返回 None 而非 Response,或路由忘记 return,导致 Starlette 找不到可发送的响应。
Workarounds
-
92% success
Ensure every code path returns a Response: return JSONResponse({'ok': True}) -
88% success
In middleware, always call await call_next(request) and return its result.
Dead Ends
Common approaches that don't work:
-
70% fail
The error is raised at the ASGI layer where the handler may not apply.
-
75% fail
Masks the real bug; the route still doesn't produce intended output.