# 断言错误：视图函数映射正在覆盖现有的端点函数：index

- **ID:** `python/flask-abort-assertion-error`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

多个路由装饰器应用于同一函数名，或同一端点名称注册了两次视图函数。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Specify different endpoint names in each decorator: @app.route('/a', endpoint='a_func') and @app.route('/b', endpoint='b_func')
   ```
2. **** (90% 成功率)
   ```
   Use unique function names for each route: def index_a(): return 'A' and def index_b(): return 'B'
   ```

## 无效尝试

- **** — The endpoint defaults to the function name; if the path is the same, Flask still sees a conflict if the old function isn't removed. (60% 失败率)
- **** — Flask uses the function name as the endpoint by default, causing overwrite unless explicit endpoint is given. (80% 失败率)
