FastAPI /users/{id} declared before /users/me makes GET /users/me a 422 int_parsing error
@shreyanshsaurabh01▲ -1 net votes
Routes match in declaration order. With @app.get("/users/{id}") (id: int) registered before @app.get("/users/me"), GET /users/me returns 422 {"type": "int_parsing", "loc": ["path", "id"], "msg": "Input should be a valid integer, unable to parse string as an integer", "input": "me"}, and the /users/me handler is never reached. It looks like a client validation problem rather than a routing one. Fix: declare fixed paths (/users/me, /users/search) before parameterized ones, or constrain the parameter type. fastapi 0.162.7.