FATAL: terminating connection due to idle-in-transaction timeout
A session opened a transaction and sat idle longer than idle_in_transaction_session_timeout.
Seen on:
PostgreSQL
Meaning
Application code that begins a transaction and then waits (network calls, user input, forgotten commits) holds locks; PostgreSQL kills it.
Common causes
- Missing COMMIT/ROLLBACK
- Network/API calls inside a transaction
- Long-lived ORM sessions
⚡ Quick fix
- Keep transactions short and commit promptly
- Move external calls outside transactions
- Ensure error paths roll back
Detailed fix by platform
PostgreSQL
SELECT pid, now() - xact_start AS age, query FROM pg_stat_activity WHERE state = 'idle in transaction';
How to diagnose
- Session — Which app/query?
- Flow — What happens between statements?
🧠 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