Weird Pydantic Errors

If your Pydantic object validation errors look like this, the reason is simple:

2 validation errors for DetailedDemand
ordqty
  __init__() takes exactly 3 positional arguments (2 given) (type=type_error)
Z
  __init__() takes exactly 3 positional arguments (2 given) (type=type_error)

You’ve raised ValidationErrors in the validator, rather than ValueErrors, TypeErrors or similar. Don’t raise ValidationErrors there, those are for collecting other errors.

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept that my given data and my IP address is sent to a server in the USA only for the purpose of spam prevention through the Akismet program.More information on Akismet and GDPR.