1967
MariaDBERRORNotableDataHIGH confidence

Illegal value for type

Production Risk

Low — function call fails; no data is modified.

What this means

A value provided to a built-in function is outside the legal range or set of values accepted by that function's parameter type.

Why it happens
  1. 1Passing a negative value to a function that only accepts non-negative values.
  2. 2Passing a value outside the valid range for a temporal function parameter.
  3. 3Invalid argument to INET_ATON or similar type-strict functions.
How to reproduce
trigger — this will error
trigger — this will error
SELECT INET_ATON('999.999.999.999'); -- invalid IP octets

expected output

ERROR 1967 (22007): Illegal value for type.

Fix

Validate input values before passing to the function

Validate input values before passing to the function
-- Validate IP address format before calling INET_ATON
SELECT CASE WHEN '192.168.1.1' REGEXP '^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}
#x27; THEN INET_ATON('192.168.1.1') ELSE NULL END;

Why this works

Pre-validate inputs to ensure they fall within the function's accepted range.

Sources
Official documentation ↗

MySQL 8.0 — 1967 ER_ILLEGAL_VALUE_FOR_TYPE

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors