# RuntimeError: Maximum number of redirects exceeded

- **ID:** `python/flask-redirect-loop-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

视图函数不断重定向到自身或其他路径，导致无限循环。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   在重定向前添加条件判断，确保不会无限重定向。
   ```
2. **** (85% success)
   ```
   使用 `abort(404)` 或返回错误响应代替重定向。
   ```

## Dead Ends

- **** — 尝试使用 `redirect(url_for('index'))` 但未添加终止条件，导致循环。 (70% fail)
- **** — 尝试在路由装饰器中设置 `redirect_to` 但未处理条件。 (60% fail)
