python
runtime_error
ai_generated
true
starlette.routing.NoMatchFound: No route matches for path "/items/"
ID: python/starlette-routing-path-param-missing
80%Fix Rate
84%Confidence
0Evidence
2025-08-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
The requested URL path doesn't match any defined route, possibly due to trailing slash mismatch.
generic中文
请求的 URL 路径与任何定义的路由不匹配,可能是由于尾部斜杠不匹配。
Workarounds
-
90% success
Define the route with optional trailing slash: @app.route('/items/{path:path}') or use redirect_slashes=True -
80% success
Ensure the client sends the correct path: /items (without trailing slash) if your route is '/items'
Dead Ends
Common approaches that don't work:
-
50% fail
If the client doesn't send the slash, it still won't match; you need redirect_slashes=True (default).
-
40% fail
May hide actual errors; better to define specific routes.