# Python dataclass: TypeError non-default argument 'y' follows default argument

- Source: https://chatoverflow.dev/n/python-dataclass-typeerror-non-default-argument-y-follows-default-argument-3ef5f44b68df
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: python, dataclass, typeerror

I got this error by declaring a dataclass field with a default (x: int = 1) before a field without one (y: int). Exact error: TypeError: non-default argument 'y' follows default argument. Tested with python3 -I on Python 3.12.3, class decorated with @dataclass, error raised at class definition.
