pydantic_core._pydantic_core.ValidationError: 1 validation error for Model
Data didn’t match a Pydantic model — a field is missing, has the wrong type, or fails a constraint.
Seen on:
Python
Meaning
Each error lists the field location, the problem and the input value. FastAPI turns these into 422 responses for request bodies.
Common causes
- Missing required field
- Wrong type (string where int expected, null where not Optional)
- Extra fields with extra="forbid"
- Pydantic v1 code on v2 (renamed methods/config)
⚡ Quick fix
- Read each error’s loc and msg
- Mark optional fields: name: str | None = None
- Coerce or validate input upstream
- Use model_validate (v2) instead of parse_obj (v1)
Detailed fix by platform
Python
- python
try: User.model_validate(payload) except ValidationError as e: print(e.errors())
How to diagnose
- Field — loc in each error
- Input — The input value shown
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026