SQLSTATE 08006Severity mediumLab verified

Incident brief

could not accept SSL connection: EOF detected

PostgreSQL started an SSL handshake on a new connection, then the peer closed the TCP socket before the handshake finished. The server logs “could not accept SSL connection: EOF detected” and drops that attempt, no backend session is established.

Reproduced on PostgreSQL 16Verified 2026-04-09 (isolated lab, PostgreSQL 16)Verified against PostgreSQL 16 with ssl=on; EOF via abrupt TCP close during handshake

In 10 seconds

What triggers it
Run PostgreSQL with ssl = on (server has a server certificate and key).
Fix
No in-database recovery: the handshake never completed, so there is no session to roll back or terminate.
Proof
Reproduced on PostgreSQL 16 → With ssl=on, opening TCP to the Postgres port and closing before the TLS handshake completed produced the exact server log line “could not accept SSL connection: EOF detected”. A normal sslmode=require psql session connected cleanly and did not emit that line.

Fix

What to do right now

The immediate, application-level response to this error.

Recovery Act now

  • No in-database recovery: the handshake never completed, so there is no session to roll back or terminate.
  • If an application is failing to connect at the same timestamps, fix that client's TLS settings or network path, the EOF line is the server noticing the abort.

Prevention Safe

  • Stop dumb TCP probes on 5432 (or teach the probe to complete a real Postgres/TLS handshake).
  • Standardize sslmode in connection strings and document whether the endpoint is TLS-terminated at a proxy or at Postgres itself.
  • Monitor rate of this log line; a sudden spike often means a new scanner, a bad deploy of connection settings, or a flapping load balancer.
Fix SQL
-- Confirm SSL is what you think it is on the server:
SHOW ssl;
SHOW ssl_cert_file;
SHOW ssl_key_file;

-- Who is connecting right now (won't show failed handshakes, those never become backends):
SELECT pid, usename, application_name, client_addr, ssl, state
FROM pg_stat_ssl
JOIN pg_stat_activity USING (pid);

-- Failed handshakes only appear in the server log. Raise log detail temporarily if needed:
-- ALTER SYSTEM SET log_connections = on;
-- SELECT pg_reload_conf();

Connected

Everything this error touches

Every page this SQLSTATE connects to: the concept that explains it, the runbooks that fix it, the parameters you tune to prevent it, and the sibling errors it travels with. All real cross-references. Jump straight in, or open the full interactive map.

Open in the interactive map →

Verification

PG 16
Last verified
2026-04-09 (isolated lab, PostgreSQL 16)
Verification scope
Verified against PostgreSQL 16 with ssl=on; EOF via abrupt TCP close during handshake
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops