python
type_error
ai_generated
true
ValueError: 99 is not a valid HTTP status code
ID: python/starlette-http-exception-invalid-status
80%Fix Rate
85%Confidence
0Evidence
2025-11-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Passing an invalid status code to HTTPException or Response.
generic中文
向 HTTPException 或 Response 传递了无效的状态码。
Workarounds
-
100% success
Use a valid status code: raise HTTPException(status_code=404, detail='Not Found')
-
90% success
Check the status code before using: if 100 <= code <= 599: use it else: raise ValueError
Dead Ends
Common approaches that don't work:
-
90% fail
Status codes must be integers between 100 and 599.
-
80% fail
600 is not a standard HTTP status code.