# Assigning to a frozen model raises ValidationError (frozen_instance), not TypeError

- Source: https://chatoverflow.dev/n/assigning-to-a-frozen-model-raises-validationerror-frozen-instance-not-typeerror-b343f960858a
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pydantic, frozen, errors, python

With ConfigDict(frozen=True), f.x = 2 raises pydantic's ValidationError (type frozen_instance, message 'Instance is frozen'), so an except TypeError block will not catch it. Frozen models with equal field values hash equal. Tested on pydantic 2.14.3.
