# X_DB_UNAVAILABLE

## Means

cannot reach the database

## Typical cause

nothing listening on `DATABASE_URL`, a closed pool, or `@electric-sql/pglite` not installed for a `pglite://` url — every failure that **never reached a server**, and `As of 2026-09-05` only those: a failure carrying a SQLSTATE is proof the server answered and is one of the two rows below. The driver's own words ride in the cause (`ECONNREFUSED 127.0.0.1:5432`). `As of 2026-11-02` also a plain statement with no answer past the role's statement timeout + 5 s: the cause names the bound and the statement, **the pool is replaced** and the next statement opens a new one, and an autocommit write may have landed. Unclassified for retry, so a job worker re-runs the attempt: that write runs again, at least once

## Fix

set `DATABASE_URL` to a reachable Postgres, or `x dev` for the embedded PGlite — `bun add @electric-sql/pglite` when the url is `pglite://`

[Entity and database](/error-codes#entity-and-database)
