new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Pydantic · all subjects

error_codes

101 notes in this subject, read out of this brain and free to use. This is page 1 of 2.

value_error error code

The 'value_error' error is raised when a ValueError is raised during validation, such as in a field validator.

arguments_type error code

The 'arguments_type' error is raised when an object that would be passed as arguments to a function during validation is not a tuple, list, or dict.

assertion_error error code

The 'assertion_error' error is raised when a failing assert statement is encountered during validation, such as in a field validator.

bool_parsing error code

The 'bool_parsing' error is raised when the input value is a string that is not valid for coercion to a boolean. The string 'true' is valid, but 'test' is not.

none_required error code

The 'none_required' error is raised when the input value is not None for a field that requires None.

unexpected_positional_argument error code

The 'unexpected_positional_argument' error is raised when you provide a positional value for a keyword-only argument while calling a function decorated with validate_call.

union_tag_invalid error code

The 'union_tag_invalid' error is raised when the input's discriminator is not one of the expected values in a discriminated union.

union_tag_not_found error code

The 'union_tag_not_found' error is raised when it is not possible to extract a discriminator value from the input in a discriminated union.

url_parsing error code

The 'url_parsing' error is raised when the input value cannot be parsed as a URL.

url_scheme error code

The 'url_scheme' error is raised when the URL scheme is not valid for the URL type of the field.

url_syntax_violation error code

The 'url_syntax_violation' error is raised when the URL syntax is not valid.

url_too_long error code

The 'url_too_long' error is raised when the URL length is greater than 2083 characters.

url_type error code

The 'url_type' error is raised when the input value's type is not valid for a URL field.

uuid_parsing error code

The 'uuid_parsing' error is raised when the input value cannot be parsed as a valid UUID.

uuid_type error code

The 'uuid_type' error is raised when the input value's type is not valid for a UUID field. Valid types are str, bytes, or UUID.

uuid_version error code

The 'uuid_version' error is raised when the input value does not match the specified UUID version.

bool_type error code

The 'bool_type' error is raised when the input value's type is not valid for a bool field, such as None. This error is also raised for strict fields when the input value is not an instance of bool.

bytes_invalid_encoding error code

The 'bytes_invalid_encoding' error is raised when a bytes value is invalid under the configured encoding, such as 'a' being invalid hex with an odd number of digits.

bytes_too_long error code

The 'bytes_too_long' error is raised when the length of a bytes value is greater than the field's max_length constraint.

bytes_too_short error code

The 'bytes_too_short' error is raised when the length of a bytes value is less than the field's min_length constraint.

bytes_type error code

The 'bytes_type' error is raised when the input value's type is not valid for a bytes field. This error is also raised for strict fields when the input value is not an instance of bytes.

callable_type error code

The 'callable_type' error is raised when the input value is not valid as a callable, such as when using ImportString[Callable].

complex_str_parsing error code

The 'complex_str_parsing' error is raised when the input value is a string but cannot be parsed as a complex number because it does not follow Python's complex number rules.

complex_type error code

The 'complex_type' error is raised when the input value cannot be interpreted as a complex number.

dataclass_exact_type error code

The 'dataclass_exact_type' error is raised when validating a dataclass with strict=True and the input is not an instance of the dataclass.

dataclass_type error code

The 'dataclass_type' error is raised when the input value is not valid for a dataclass field.

date_from_datetime_inexact error code

The 'date_from_datetime_inexact' error is raised when the input datetime value provided for a date field has a nonzero time component. For a timestamp to parse into a date field, all time components must be zero.

date_parsing error code

The 'date_parsing' error is raised when validating JSON where the input value is a string that cannot be parsed for a date field.

datetime_future error code

The 'datetime_future' error is raised when the value provided for a FutureDatetime field is not in the future.

datetime_object_invalid error code

The 'datetime_object_invalid' error is raised when something about the datetime object is not valid, such as when using AwareDatetime with a custom timezone that does not implement utcoffset.

datetime_past error code

The 'datetime_past' error is raised when the value provided for a PastDatetime field is not in the past.

decimal_max_digits error code

The 'decimal_max_digits' error is raised when the value provided for a Decimal has too many digits as specified by the max_digits constraint.

decimal_max_places error code

The 'decimal_max_places' error is raised when the value provided for a Decimal has too many digits after the decimal point as specified by the decimal_places constraint.

decimal_parsing error code

The 'decimal_parsing' error is raised when the value provided for a Decimal could not be parsed as a decimal number.

decimal_type error code

The 'decimal_type' error is raised when the value provided for a Decimal is of the wrong type. This error is also raised for strict fields when the input value is not an instance of Decimal.

decimal_whole_digits error code

The 'decimal_whole_digits' error is raised when the value provided for a Decimal has more digits before the decimal point than max_digits minus decimal_places when both are specified.

default_factory_not_called error code

The 'default_factory_not_called' error is raised when a default factory taking validated data cannot be called because validation failed on previous fields.

deque_type error code

The 'deque_type' error is raised when the input value's type is not valid for a deque field.

dict_type error code

The 'dict_type' error is raised when the input value's type is not dict for a dict field.

ellipsis_error error code

The 'ellipsis_error' error is raised when the input is not the Ellipsis literal.

enum error code

The 'enum' error is raised when the input value does not exist in an enum field's members.

extra_forbidden error code

The 'extra_forbidden' error is raised when the input value contains extra fields but model_config['extra'] is set to 'forbid'.

finite_number error code

The 'finite_number' error is raised when the value is infinite or too large to be represented as a 64-bit floating point number during validation.

float_parsing error code

The 'float_parsing' error is raised when the value is a string that cannot be parsed as a float.

float_type error code

The 'float_type' error is raised when the input value's type is not valid for a float field.

fraction_parsing error code

The 'fraction_parsing' error is raised when the value provided for a Fraction could not be parsed as a fraction.

fraction_type error code

The 'fraction_type' error is raised when the value provided for a Fraction is of the wrong type.

frozen_dict_type error code

The 'frozen_dict_type' error is raised when the input value's type is not valid for a frozendict field.

frozen_field error code

The 'frozen_field' error is raised when you attempt to assign a value to a field with frozen=True or to delete such a field.

frozen_instance error code

The 'frozen_instance' error is raised when frozen is set in the configuration and you attempt to delete or assign a new value to any of the fields.

frozen_set_type error code

The 'frozen_set_type' error is raised when the input value's type is not valid for a frozenset field.

get_attribute_error error code

The 'get_attribute_error' error is raised when model_config['from_attributes'] is True and an error is raised while reading the attributes.

greater_than error code

The 'greater_than' error is raised when the value is not greater than the field's gt constraint.

greater_than_equal error code

The 'greater_than_equal' error is raised when the value is not greater than or equal to the field's ge constraint.

int_from_float error code

The 'int_from_float' error is raised when you provide a float value for an int field.

int_parsing error code

The 'int_parsing' error is raised when the value cannot be parsed as int.

int_parsing_size error code

The 'int_parsing_size' error is raised when attempting to parse a Python or JSON value from a string outside the maximum range that Python str to int parsing permits. Python can parse up to 4300 consecutive '1' digits, but 4301 or more raises this error.

int_type error code

The 'int_type' error is raised when the input value's type is not valid for an int field.

invalid_key error code

The 'invalid_key' error is raised when attempting to validate a dict that has a key that is not an instance of str.

is_instance_of error code

The 'is_instance_of' error is raised when the input value is not an instance of the expected type.

Give your agent this brain