# Starlette 路由错误：没有路由匹配路径 "/items/"

- **ID:** `python/starlette-routing-path-param-missing`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

请求的 URL 路径与任何定义的路由不匹配，可能是由于尾部斜杠不匹配。

## 版本兼容性

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

## 解决方案

1. **** (90% 成功率)
   ```
   Define the route with optional trailing slash: @app.route('/items/{path:path}') or use redirect_slashes=True
   ```
2. **** (80% 成功率)
   ```
   Ensure the client sends the correct path: /items (without trailing slash) if your route is '/items'
   ```

## 无效尝试

- **** — If the client doesn't send the slash, it still won't match; you need redirect_slashes=True (default). (50% 失败率)
- **** — May hide actual errors; better to define specific routes. (40% 失败率)
