# 08004 — sqlserver_rejected_establishment_of_sqlconnection

> PostgreSQL SQLSTATE 08004: sqlserver_rejected_establishment_of_sqlconnection, source-backed diagnosis and recovery guidance.
---

# 08004

## At a glance {#at-a-glance}

SQLSTATE `08004` is **sqlserver_rejected_establishment_of_sqlconnection** in Class `08`. `08004` is the SQL-standard name for a server-rejected connection establishment. The fixed PostgreSQL 18.6 and 10.23 core-call scans contain no resolved PostgreSQL `ereport` path for this code.

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| Field | Value |
| --- | --- |
| SQLSTATE | `08004` |
| Condition | `sqlserver_rejected_establishment_of_sqlconnection` |
| Status | `active` |
| Known present by | `7.4` |
| Locked snapshots | `9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3` |
| Macros | `ERRCODE_SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION` |
| Aliases | `—` |

<!-- source facts: data/errcodes/08004.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#meaning}

`08004` is the SQL-standard name for a server-rejected connection establishment. The fixed PostgreSQL 18.6 and 10.23 core-call scans contain no resolved PostgreSQL `ereport` path for this code.

## Diagnosis {#diagnosis}

Use the server ErrorResponse and authentication logs to identify the concrete condition. PostgreSQL paths in this scope use specific codes such as 28000 or 28P01; a client-side exception without a server field is not evidence for 08004.

## Response {#response}

Fix the actual authentication, authorization, or endpoint problem and open a new connection. Keep 08004 as a definition/reference boundary here; no synthetic `RAISE` or fake rejected-login case is claimed.

## Messages {#messages}

This scope has no confirmed fixed primary-message template for `08004`; the available definition/source records do not establish one. Do not treat a client exception without a matching server diagnostic as proof of `08004`.

## Representative case {#case}

This page has no selected natural SQL run. The structured evidence records a source or definition boundary; a client-side `RAISE` would not represent a backend mechanism.

## Versions {#versions}

The generated facts table records the locked catalogue snapshots and earliest observed definition. This page has no selected natural SQL run; its fixed REL_18_6/REL_10_23 source boundary must not be read as an observed runtime result or as a claim about every intermediate release.

## Related {#related}

- [`08001` — sqlclient_unable_to_establish_sqlconnection](../08001/)
- [`28000` — invalid_authorization_specification](../28000/)
- [`28P01` — related condition](../28p01/)

## Sources {#sources}

- `src.errcodes.18.6` — `src/backend/utils/errcodes.txt` at `REL_18_6` commit `724edf9bde9d356724ad384a2e196edc3c9f80f7`; fixed blob SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba` ([source](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt)).
- `src.calls.REL_18_6` / `src.calls.REL_10_23` — fixed local call scans, SHA-256 `9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf` / `00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c`; these scans preserve the resolved call context used by the claims.
