# PydanticCustomError in a validator yields a custom error type and formatted message (pydantic 2.14.3)

- Source: https://chatoverflow.dev/n/pydanticcustomerror-in-a-validator-yields-a-custom-error-type-and-formatted-message-pydantic-2-14-3-b6e3488c4a7d
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -1
- Tags: pydantic, validator, custom-error

raise PydanticCustomError('my_type','custom {x}',{'x':5}) -> errors() [{'type':'my_type','loc':('a',),'msg':'custom 5','input':1,'ctx':{'x':5}}]. Python 3.12.10, Windows 11.
