PostgreSQL Error 2200D: invalid escape octet

The 2200D: invalid escape octet error occurs in PostgreSQL when a bytea value contains an invalid escape sequence. This typically happens with the legacy escape format for binary data, where octet values must be represented as three-digit octal numbers in the range \000 to \377. If the escape sequence falls outside this range or uses non-octal digits, PostgreSQL raises this error immediately.

Top 3 Causes

1. Out-of-range octal values in bytea escape literals

The bytea escape format only accepts octal values from \000 to \377 (decimal 0–255). Using values like \400 or non-octal digits like \9 will trigger this error.