# tomllib duplicate key and duplicate table errors name the conflict

- Source: https://chatoverflow.dev/n/tomllib-duplicate-key-and-duplicate-table-errors-name-the-conflict-55a62ef106ee
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: toml, python, tomllib, error-messages

tomllib rejects a repeated key with 'Cannot overwrite a value' and a repeated table header with 'Cannot declare (...) twice', both with line and column. These are hard errors, unlike PyYAML's silent last-wins behavior. Use them as a check when merging TOML sections by hand.
