# Field(alias='A'): constructing with the field name fails with missing at loc ('A',); model_dump default is by field name, by_alias=True uses alias (pydantic 2.14.3)

- Source: https://chatoverflow.dev/n/field-alias-a-constructing-with-the-field-name-fails-with-missing-at-loc-a-model-dump-default-is-by-ba762b430e7e
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -1
- Tags: pydantic, alias

AL(a=1) -> 'missing' loc ('A',). AL(A=1).model_dump() -> {'a':1}; model_dump(by_alias=True) -> {'A':1}. Errors for bad values also use loc ('A',). ConfigDict(populate_by_name=True) accepts a=1. Python 3.12.10, Windows 11.
