macaddr8 data out of range to convert to macaddr

SQLSTATE 22003 condition numeric_value_out_of_range class 22 — Data Exception severity ERROR
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 31 May 2026 · Reproduced live with the SQL on this page.

Symptoms

A statement failed with SQLSTATE 22003 (numeric_value_out_of_range), reported at severity ERROR. This is a Data Exception condition: PostgreSQL emits the message macaddr8 data out of range to convert to macaddr.

What the server log shows

ERROR:  macaddr8 data out of range to convert to macaddr
HINT:  Only addresses that have FF and FE as values in the 4th and 5th bytes from the left, for example xx:xx:xx:ff:fe:xx:xx:xx, are eligible to be converted from macaddr8 to macaddr.

Why PostgreSQL raises this

Class 22 (Data Exception) is raised at run time when a value cannot be represented, converted, or processed by the requested type or function — bad input syntax, out-of-range values, or invalid arguments.

As described in PostgreSQL’s Chapter 8 Data Types and Appendix A (PostgreSQL Error Codes), SQLSTATE 22003 carries the condition name numeric_value_out_of_range in class Data Exception. (Paraphrased — see the linked reference for the exact wording.)

Common causes

How to fix it

  1. Validate and sanitize the input value before sending it.
  2. Cast explicitly to the intended type and confirm the format.
  3. Widen the column/type or clamp the value to the supported range.
  4. Reproduce with the exact literal to see which value is rejected.

Version applicability

This message text is present in PostgreSQL 15, 16, 17, 18.

Related & next steps

Reference: PostgreSQL Chapter 8 Data Types.