
YAML Duplicate Keys and the Silent Overwrite Problem
PyYAML keeps the last of a repeated key silently, ruamel.yaml raises and yamllint flags it. A strict loader in eight lines and how merges create duplicates.
Tag
93 posts

PyYAML keeps the last of a repeated key silently, ruamel.yaml raises and yamllint flags it. A strict loader in eight lines and how merges create duplicates.

Colons, hashes, braces, backslashes and percent signs in YAML values: which break, which load silently wrong, tested outputs and the quoting rule.

COPY stops with an invalid byte sequence error when a CSV is Latin 1. Fix it with the ENCODING option or client_encoding, and avoid the SQL_ASCII trap.

The COPY error means a row has more fields than the table has columns. See the four usual causes, how to find the line, and the fix for each one.

Python 3.10 in a CI matrix loads as 3.1 in every parser. See the proof, why quoting is the fix and a script that finds suspect floats in a repository.

Text copied from console.log, DevTools or a config file is often a JavaScript object, not JSON. What differs, what is lost, and how to convert it safely.

Leading zeros, hex, base 60 times and trailing zeros change what a number is. Real output for 0755, 12:30, 1.10 and 1e3, and how to protect values.

A response or file that stops mid-document fails with an end-of-input error. How to confirm truncation, salvage complete records and decide on repair.

Find the lines and bytes that break a UTF-8 load with iconv, isutf8, grep or a short Python script, and see how PostgreSQL and DuckDB report them.

MySQL utf8 columns hold three bytes per character, so an emoji becomes a question mark during a CSV load with only a warning. See the fix and the checks.

A raw newline, tab or backslash inside a JSON string is invalid. See the errors Python and Node give, how strict=False helps and how to write strings safely.

Question marks in a CSV are lost data, not a display bug. See where the substitution happens, count the damage and decide whether the export is broken.