python
config_error
ai_generated
true
ValueError: Unknown path converter 'int'
ID: python/starlette-route-param-converter
80%Fix Rate
85%Confidence
0Evidence
2026-05-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Using a path converter that Starlette doesn't support, such as int without proper syntax.
generic中文
使用了 Starlette 不支持的路径转换器,如 int 但语法不正确。
Workarounds
-
100% success
Use the correct syntax: @app.route('/items/{item_id:int}') -
95% success
In FastAPI, use type annotation: @app.get('/items/{item_id}') with item_id: int
Dead Ends
Common approaches that don't work:
-
70% fail
Starlette uses {item_id:int} syntax, but it must be exactly that; if you use {item_id} with a type annotation, it's different.
-
30% fail
The converter is built-in; no import needed.