# 值错误：99 不是有效的 HTTP 状态码

- **ID:** `python/starlette-http-exception-invalid-status`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

向 HTTPException 或 Response 传递了无效的状态码。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (100% 成功率)
   ```
   Use a valid status code: raise HTTPException(status_code=404, detail='Not Found')
   ```
2. **** (90% 成功率)
   ```
   Check the status code before using: if 100 <= code <= 599: use it else: raise ValueError
   ```

## 无效尝试

- **** — Status codes must be integers between 100 and 599. (90% 失败率)
- **** — 600 is not a standard HTTP status code. (80% 失败率)
