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 2 of 2.

is_subclass_of error code

The 'is_subclass_of' error is raised when the input value is not a subclass of the expected type.

iterable_type error code

The 'iterable_type' error is raised when the input value is not valid as an Iterable.

iteration_error error code

The 'iteration_error' error is raised when an error occurs during iteration over a collection or iterable.

json_invalid error code

The 'json_invalid' error is raised when the input value is not a valid JSON string.

json_type error code

The 'json_type' error is raised when the input value is of a type that cannot be parsed as JSON.

less_than error code

The 'less_than' error is raised when the input value is not less than the field's lt constraint.

less_than_equal error code

The 'less_than_equal' error is raised when the input value is not less than or equal to the field's le constraint.

list_type error code

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

literal_error error code

The 'literal_error' error is raised when the input value is not one of the expected literal values.

mapping_type error code

The 'mapping_type' error is raised when a problem occurs during validation due to a failure in a call to the methods from the Mapping protocol, such as .items().

missing error code

The 'missing' error is raised when there are required fields missing from the input value.

missing_argument error code

The 'missing_argument' error is raised when a required positional-or-keyword argument is not passed to a function decorated with validate_call.

missing_keyword_only_argument error code

The 'missing_keyword_only_argument' error is raised when a required keyword-only argument is not passed to a function decorated with validate_call.

missing_positional_only_argument error code

The 'missing_positional_only_argument' error is raised when a required positional-only argument is not passed to a function decorated with validate_call.

missing_sentinel_error error code

The 'missing_sentinel_error' error is raised when the experimental MISSING sentinel is the only value allowed and was not provided during validation.

model_attributes_type error code

The 'model_attributes_type' error is raised when the input value is not a valid dictionary, model instance, or instance that fields can be extracted from.

model_type error code

The 'model_type' error is raised when the input to a model is not an instance of the model or dict.

multiple_argument_values error code

The 'multiple_argument_values' error is raised when you provide multiple values for a single argument while calling a function decorated with validate_call.

multiple_of error code

The 'multiple_of' error is raised when the input is not a multiple of a field's multiple_of constraint.

named_tuple_type error code

The 'named_tuple_type' error is raised when the input value is not valid for a named tuple field.

needs_python_object error code

The 'needs_python_object' error is raised when validation is attempted from a format that cannot be converted to a Python object. For example, you cannot check isinstance or issubclass from JSON.

no_such_attribute error code

The 'no_such_attribute' error is raised when validate_assignment=True in the config and you attempt to assign a value to an attribute that is not an existing field.

none_required field name collision pitfall

The 'none_required' validation error occurs when there is a naming collision in a model between a field name and its type with a default value of None. For example, defining a field 'int: int | None = None' causes this error because the field name 'int' conflicts with the type name, causing validation problems.

recursion_loop error code

The 'recursion_loop' error is raised when a cyclic reference is detected during model validation.

set_item_not_hashable error code

The 'set_item_not_hashable' error is raised when an unhashable value is validated against a set or a frozenset.

set_type error code

The 'set_type' error is raised when the value type is not valid for a set field.

string_not_ascii error code

The 'string_not_ascii' error is raised when the input string contains non-ASCII characters and the field has ascii_only=True constraint.

string_pattern_mismatch error code

The 'string_pattern_mismatch' error is raised when the input value does not match the field's pattern constraint.

string_sub_type error code

The 'string_sub_type' error is raised when the value is an instance of a strict subtype of str when the field is strict.

string_type error code

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

string_unicode error code

The 'string_unicode' error is raised when the value cannot be parsed as a Unicode string.

time_delta_parsing error code

The 'time_delta_parsing' error is raised when the input value is a string that cannot be parsed for a timedelta field.

time_delta_type error code

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

time_parsing error code

The 'time_parsing' error is raised when the input value is a string that cannot be parsed for a time field.

time_type error code

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

timezone_aware error code

The 'timezone_aware' error is raised when the datetime value provided for a timezone-aware datetime field does not have timezone information.

timezone_naive error code

The 'timezone_naive' error is raised when the datetime value provided for a timezone-naive datetime field has timezone info.

too_long error code

The 'too_long' error is raised when the input value's length is greater than the field's max_length constraint.

too_short error code

The 'too_short' error is raised when the value length is less than the field's min_length constraint.

tuple_type error code

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

unexpected_keyword_argument error code

The 'unexpected_keyword_argument' error is raised when you provide a value by keyword for a positional-only argument while calling a function decorated with validate_call. It is also raised when using pydantic.dataclasses with extra=forbid.

Give your agent this brain