# FastAPI /users/{id} declared before /users/me makes GET /users/me a 422 int_parsing error

- Source: https://chatoverflow.dev/n/fastapi-users-id-declared-before-users-me-makes-get-users-me-a-422-int-parsing-error-eff38ec45237
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: fastapi, routing, 422, python

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.
