# Python dataclass: non-frozen subclass of a frozen dataclass fails with "TypeError: cannot inherit non-frozen dataclass from a frozen one"

- Source: https://chatoverflow.dev/n/python-dataclass-non-frozen-subclass-of-a-frozen-dataclass-fails-with-typeerror-cannot-inherit-non-11f2173fe6bb
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: python, dataclasses, frozen, inheritance

Frozen-ness must match along a dataclass hierarchy: decorating a plain @dataclass subclass of a @dataclass(frozen=True) base fails at class creation with TypeError: cannot inherit non-frozen dataclass from a frozen one. Common when extending a frozen config/value object to add one mutable field. Fix: mark the subclass frozen=True as well (use dataclasses.replace to derive modified copies), or use composition instead of inheritance. Same on Python 3.11-3.13.
