# werkzeug.routing.exceptions.BuildError: 无法为端点 'user_profile' 构建 URL。你是不是想用 'user'？

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

## 根因

url_for() 引用的端点名称不存在，或与注册的视图函数名称拼写不一致。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   @app.route('/profile')
def user_profile(): ...
url_for('user_profile')
   ```
2. **** (90% 成功率)
   ```
   print(app.url_map)
   ```

## 无效尝试

- **** — Breaks on app mounted under a prefix or behind a proxy; loses url_for's escaping. (70% 失败率)
- **** — Unrelated to endpoint name resolution. (85% 失败率)
