# 39001 — invalid_sqlstate_returned

> Source-backed reference for PostgreSQL SQLSTATE 39001.
---

# 39001

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

The fixed definition contains this member, but the resolved PostgreSQL 18.6 core/contrib scan found no report group. The name describes an external routine returning an invalid SQLSTATE; it does not identify a current PostgreSQL handler path.

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

| Field | Value |
| --- | --- |
| SQLSTATE | `39001` |
| Condition | `invalid_sqlstate_returned` |
| 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_E_R_I_E_INVALID_SQLSTATE_RETURNED` |
| Aliases | `—` |

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

## Meaning {#meaning}

Keep the returned text, external language, routine, and wrapper that rejected it. Do not replace the member with `XX000` or infer the bad value from a routine name.

## Messages {#messages}

No fixed PostgreSQL message variant was adopted because the bounded scan did not resolve a native report group.

## Diagnosis {#diagnosis}

Find the fixed external routine handler or driver validator and inspect the five-character value and message. The bounded scan leaves the native source boundary unresolved.

## Response {#response}

Repair the routine’s returned SQLSTATE or the interface contract according to its owner. Do not retry until the invalid return and completion state are understood.

## Versions {#versions}

The locked catalogue places this condition at least by PostgreSQL 7.4. The facts block lists the published snapshots; source-path status is limited to the fixed PostgreSQL 18.6 evidence below.

## Related {#related}

[`39000`](../39000/), [`2F000`](../2f000/)

## Sources {#sources}

See the fixed source links and message limits in the structured [evidence record](../data/evidence/39001.json).
