# PostgreSQL: root certificate file "/home/user/.postgresql/root.crt" does not exist. Either provide the file or change sslmode

**Code:** `root certificate file "root.crt" does not exist` · **Category:** SSL / TLS · **Seen on:** SSL, PostgreSQL, Linux

The connection string asks for certificate verification (`sslmode=verify-ca` or `verify-full`) but no CA file was provided.

## 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

1. Download the provider's CA bundle and set `sslrootcert=/path/bundle.pem`
2. Set `PGSSLROOTCERT`
3. Use `sslrootcert=system` (PG16+) for public-CA servers

## Detailed fix by platform

### Linux

1. `psql "host=db.example.com dbname=app user=me sslmode=verify-full sslrootcert=/etc/ssl/rds-ca.pem"`

## How to diagnose

1. **Mode** — sslmode value?
2. **File** — sslrootcert path?
3. **Provider** — CA bundle?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ssl/psql-root-certificate-file-does-not-exist)
