ERROR: value too long for type character varying(255)
A string exceeds the column’s varchar length.
Seen on:
PostgreSQL
Meaning
PostgreSQL rejects (doesn’t truncate) oversized values. In PostgreSQL, text has no performance penalty versus varchar.
Common causes
- Input longer than the declared length
- Multi-language text longer than expected
- URLs/user agents in short columns
⚡ Quick fix
- Validate lengths in the app
- Widen the column or switch to text with a CHECK if needed
Detailed fix by platform
PostgreSQL
ALTER TABLE visits ALTER COLUMN user_agent TYPE text;
How to diagnose
- Column — Which one (find by length)?
- Value — Actual length
🧠 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