PostgreSQL: root certificate file "/home/user/.postgresql/root.crt" does not exist. Either provide the file or change sslmode
The connection string asks for certificate verification (sslmode=verify-ca or verify-full) but no CA file was provided.
root certificate file "root.crt" does not existEither provide the file or change sslmode to disable server certificate verificationpsql: error: root certificate file does not existSSL error: certificate verify failed (sslmode verify-full) Meaning
Provide the CA with sslrootcert=/path/ca.pem (or PGSSLROOTCERT), or use sslrootcert=system on PostgreSQL 16+ to use the OS store. Managed databases (RDS, Cloud SQL, Azure) publish CA bundles to download. Only lower to sslmode=require if encryption without verification is acceptable.
Common causes
- sslmode=verify-full without sslrootcert
- Default ~/.postgresql/root.crt missing
- Managed DB CA bundle not downloaded
- Wrong file path in container
- Connection string from a template with verify-full
⚡ Quick fix
- Download the provider's CA bundle and set
sslrootcert=/path/bundle.pem - Set
PGSSLROOTCERT - Use
sslrootcert=system(PG16+) for public-CA servers
Detailed fix by platform
Linux
psql "host=db.example.com dbname=app user=me sslmode=verify-full sslrootcert=/etc/ssl/rds-ca.pem"
How to diagnose
- Mode — sslmode value?
- File — sslrootcert path?
- Provider — CA bundle?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- AH01909: server certificate does NOT include an ID which matches the server name Apache: [ssl:warn] AH01909: example.com:443:0 server certificate does NOT include an ID which matches the server name
- CAA record forbids issuance Let's Encrypt/CA: CAA record for example.com prevents issuance
- MySQL: SSL connection error: SSL is required but the server doesn't support it MySQL: ERROR 2026 (HY000): SSL connection error: SSL is required but the server doesn't support it
Most viewed in SSL / TLS
- NET::ERR_CERT_COMMON_NAME_INVALID NET::ERR_CERT_COMMON_NAME_INVALID: Your connection is not private (certificate is for a different domain)
- Challenge failed for domain Let’s Encrypt / Certbot: Challenge failed for domain example.com — Invalid response from http://example.com/.well-known/acme-challenge/x: 404
- no start line OpenSSL: unable to load certificate / PEM routines:get_name:no start line (key values mismatch)
Other ways to find it
Where this error sits
Origin: Network. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026