# werkzeug.routing.exceptions.BuildError: Could not build url for endpoint 'user_profile' with values ['user_id']. Did you mean 'index' instead?

- **ID:** `python/flask-url-for-build-error`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

URL 构建时端点不存在或参数不匹配路由规则。

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   检查端点名称是否与 @app.route 中的 endpoint 参数一致，或使用默认函数名
   ```
2. **** (90% success)
   ```
   确保传递所有必需参数，如 url_for('user_profile', user_id=123)
   ```
3. **** (85% success)
   ```
   使用 app.url_map 查看已注册端点
   ```

## Dead Ends

- **** — 不一致导致其他部分仍然报错。 (60% fail)
- **** — 如果路由需要参数，则无法正确生成。 (80% fail)
- **** — 失去 Flask 的动态 URL 优势，且维护困难。 (70% fail)
