1367
MariaDBerrordatahigh confidence

Illegal value for type

Production Risk

Medium — inserts fail or data is silently mangled depending on sql_mode.

What this means

A value was supplied that is not legal for the target column type (e.g. inserting an invalid geometry or out-of-range ENUM/SET value).

Why it happens
  1. 1Inserting malformed WKT/WKB into a spatial column
  2. 2Using a value outside the defined ENUM members
  3. 3Bit-field value exceeding the column width
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t (geom_col) VALUES (ST_GeomFromText('INVALID_WKT'));

expected output

ERROR 1367 (HY000): Illegal non geometric '...' value found during parsing

Fix 1

Validate spatial values before insert

Validate spatial values before insert
SELECT ST_IsValid(ST_GeomFromText('POINT(0 0)'));

Why this works

ST_IsValid confirms geometry is well-formed.

Fix 2

Use correct ENUM values

Use correct ENUM values
SHOW COLUMNS FROM t LIKE 'col';

Why this works

Reveals the permitted ENUM members.

Sources
Official documentation ↗

MySQL 8.0 — 1367 ER_ILLEGAL_VALUE_FOR_TYPE

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

← All MariaDB errors