pydantic_core._pydantic_core.ValidationError: 1 validation error for User email Field required [type=missing, input_value={'name': 'Ada'}, input_type=dict]

Python · updated 2026-11-03

Raised when a Pydantic model is built from data that does not fit it: Model(**data), Model.model_validate(data), or settings loading. Each error line names the field, the error type and the input value, so the message itself usually says what to fix.

Traceback (most recent call last):
  File "/app/sync.py", line 31, in import_users
    user = User.model_validate(row)
pydantic_core._pydantic_core.ValidationError: 1 validation error for User
email
  Field required [type=missing, input_value={'name': 'Ada'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/missing

Quick fix

Read each error block: the first line is the field, then the error type in brackets (missing, string_type, int_parsing) and the input value. Fix the data source, or change the model: give optional fields a default (email: str | None = None), or accept aliases if the source uses different names.

  1. Find the field name and [type=...] for each error.
  2. type=missing: the input has no such key; check spelling, aliases (Field(alias=...)) and whether the field should have a default.
  3. type=string_type or int_parsing: the value has the wrong type; convert at the source or use a looser type.
  4. For outside input, catch ValidationError and return the errors() list as a 422 or 400 instead of a 500.
  5. For settings (pydantic-settings), a missing environment variable raises this at startup: set it or give it a default.
python
from pydantic import BaseModel, Field, ValidationError

class User(BaseModel):
    name: str
    email: str | None = None                    # optional needs a default in Pydantic v2
    signup_date: str = Field(alias="signupDate")  # source uses camelCase

try:
    user = User.model_validate(row)
except ValidationError as e:
    log.warning("bad row %s: %s", row.get("id"), e.errors(include_url=False))
    raise

Why it happens

Optional fields without a default

In Pydantic v2, str | None means the value may be None, but the field is still required unless it has a default. Inputs that omit it fail with type=missing.

Different field names in the source

APIs and databases often use camelCase or other names. Without alias settings the model sees the key as missing.

Types that do not convert

Strict mode, "abc" for an int field, or a list where a string is expected produce type errors with the received input shown.

Settings and environment variables

pydantic-settings validates environment variables at startup, so a missing or malformed value stops the app with this error.

Other fixes

  • Use e.errors() for structured details in logs and API responses; e.json() gives the same as JSON.
  • model_config = ConfigDict(populate_by_name=True) lets a model accept both the field name and its alias.

Same error, other wording

  • pydantic_core._pydantic_core.ValidationError: 1 validation error for Settings database_url Field required [type=missing]
  • pydantic_core._pydantic_core.ValidationError: 2 validation errors for Order qty Input should be a valid integer, unable to parse string as an integer [type=int_parsing]
  • pydantic.error_wrappers.ValidationError: 1 validation error for User (Pydantic v1)

Let your coding agent catch the next one

Runheed records this error in production with the stack trace, the breadcrumbs before it and the agent session that shipped the code, and serves it to Claude Code, Cursor or any MCP client. With it connected, you can ask:

> Find the Pydantic ValidationError exceptions in production, group them by model, field and error type, show me the input values that failed, and fix the model defaults, aliases or the data source.

Plans from $29/moSee what your agent readsSee the setupCancel any time from the billing portal

Related errors

References: Pydantic docs: validation errors, Pydantic docs: fields (defaults and aliases)