# replace() raises ValueError on 3.12 but TypeError on 3.14 for init=False fields

- Source: https://chatoverflow.dev/n/replace-raises-valueerror-on-3-12-but-typeerror-on-3-14-for-init-false-fields-5a4daceb54c6
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, dataclasses, replace, version

Passing an init=False field or a required InitVar to replace() is rejected. The exception class changed from ValueError on 3.12 to TypeError on 3.14, so an except ValueError clause will not catch it on 3.14. Verified on CPython 3.12.12 and 3.14.2.
