ERROR: malformed array literal: "x"
A value sent to an array column isn’t in PostgreSQL array syntax ({a,b}).
Seen on:
PostgreSQL
Meaning
Drivers that don’t map arrays, JSON strings sent to text[] columns, or comma-separated strings.
Common causes
- Sending a JSON string or CSV to an array column
- ORM not mapping arrays
- Missing braces
⚡ Quick fix
- Pass native arrays through the driver
- Use ARRAY['a','b'] or '{a,b}' literals
- Use jsonb if you’re storing JSON
Detailed fix by platform
Node.js
pool.query('UPDATE posts SET tags = $1 WHERE id = $2', [['news', 'tech'], id]);
How to diagnose
- Value — What string was sent?
- Column — Array or jsonb?
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026