ERROR: invalid input syntax for type uuid: "x"
A value that isn’t a valid UUID was compared with or inserted into a uuid column.
Seen on:
PostgreSQL
Meaning
Route parameters like "me", "new" or "undefined", or integer ids passed to uuid columns.
Common causes
- Non-UUID route parameters
- "undefined" from the client
- Mixing integer ids and uuid columns
⚡ Quick fix
- Validate the UUID format before querying and return 404/400
- Order routes so /items/new isn’t treated as an id
Detailed fix by platform
PostgreSQL
SELECT * FROM items WHERE id = $1::uuid; -- after validating $1 in the app
How to diagnose
- Value — What string?
- Route — Which route matched?
🧠 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