22P02 PostgreSQL Origin: Data Last updated 13 Oct 2026

ERROR: invalid input syntax for type integer: "abc"

A string couldn’t be converted to the column’s type (integer, numeric, boolean, date…).

Exact message you may see invalid input syntax for type integerinvalid input syntax for type
Seen on: PostgreSQL

Meaning

Empty strings, "undefined"/"null" strings from JavaScript, or text in numeric columns. PostgreSQL never treats '' as NULL.

Common causes

  • Empty string '' for numeric columns
  • "undefined" from a frontend
  • Wrong parameter order in queries

⚡ Quick fix

  1. Send NULL instead of ''
  2. Validate/parse input before querying
  3. Check parameter positions

Detailed fix by platform

PostgreSQL

  1. INSERT INTO items (qty) VALUES (NULLIF($1, '')::int);

How to diagnose

  1. Value — Quoted in the message
  2. Column — Expected type

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1264 — MySQL ERROR 1264 (22003): Out of range value for column 'x' at row 1 (MySQL)12641366 — MySQL ERROR 1366 (HY000): Incorrect integer value: '' for column 'x' at row 1 (MySQL)13661690 — MySQL ERROR 1690 (22003): BIGINT UNSIGNED value is out of range (MySQL)169022001 — ERROR: value too long for type character varying(255) (PostgreSQL)2200122003 — ERROR: numeric field overflow — A field with precision 5, scale 2 must round to an absolute value less than 10^3 (PostgreSQL)2200322008 — ERROR: date/time field value out of range: "31/12/2024" — HINT: Perhaps you need a different "datestyle" setting. (PostgreSQL)2200822P02 uuid — ERROR: invalid input syntax for type uuid: "x" (PostgreSQL)22P02 uuid23502 — ERROR: null value in column "x" of relation "y" violates not-null constraint (PostgreSQL)2350222P02

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.