# Postgres error 08001: could not connect to server / connection refused

> The client could not open a connection at all, before any authentication happened.

Source: https://scribase.com/postgres-errors/08001

SQLSTATE class: Connection Exception. Over PostgREST/supabase-js this maps to HTTP 503.

## Causes

- Wrong host or port, or the server is not listening on that address.
- A firewall, security group or IP allow list blocks the client address.
- The server is down, starting up, or waking from scale to zero and the client gave up too early.
- TLS was required by the server but not offered by the client (or the reverse).

## Fixes

- Check host, port and sslmode in the connection string; try psql with the same string to separate app problems from network problems.
- Add the client IP to the allow list, or connect from an allowed network.
- Raise the connect timeout for databases that may be asleep.