39000 — external_routine_invocation_exception
Fixed PostgreSQL 18.6 paths in contrib/pgcrypto report this ERROR for cryptographic library failures and invalid input lengths. The category can also carry other external routine invocation errors, so the exact library function and dynamic error text matter.
English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- aliases
- Unknown
- class name
- External Routine Invocation Exception
- condition name
- external_routine_invocation_exception
- lang
- en
- sqlstate
- 39000
Definition PG 18
39000
At a glance {#at-a-glance}
Fixed PostgreSQL 18.6 paths in contrib/pgcrypto report this ERROR for cryptographic library failures and invalid input lengths. The category can also carry other external routine invocation errors, so the exact library function and dynamic error text matter.
Meaning {#meaning}
Representative messages are crypt(3) returned NULL, encrypt error: %s, decrypt error: %s, encrypt_iv error: %s, decrypt_iv error: %s, and Length not in range. Several primary messages interpolate the dynamic library text returned by px_strerror(err); it is part of the primary message, not a separate DETAIL field.
Messages {#messages}
Representative messages include crypt(3) returned NULL, encrypt error: %s, decrypt error: %s, encrypt_iv error: %s, decrypt_iv error: %s, and Length not in range. Several variants put the dynamic library text from px_strerror(err) directly in the primary message; it is not a separate DETAIL field.
Diagnosis {#diagnosis}
Identify the pgcrypto function and operation (crypt, encrypt/decrypt, IV form, or length validation). Preserve the dynamic error string and check input lengths, key/IV parameters, and library boundary; do not merge a library error with a SQLSTATE from a remote routine.
Response {#response}
Correct the named input or library/configuration problem and validate the same pgcrypto operation. Retry only when the operation is safe and no externally visible work was completed; a failed encryption call does not justify replaying a surrounding write.
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}
Sources {#sources}
Read the fixed pgcrypto.c, pgp-cfb.c, and px.c paths alongside the structured evidence record.
Compare versions
SQLSTATE evidence and recorded runtime versions
claims · identity
{
"claim_id": "identity",
"limits": "",
"method": "Read the fixed errcodes definition row, severity, and macro.",
"position": 0,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "39000 is external_routine_invocation_exception in SQLSTATE Class 39."
}claims · resolved-path
{
"claim_id": "resolved-path",
"limits": "Source confirmation is not a runtime observation in this batch.",
"method": "Read the complete source context around the resolved report groups.",
"position": 1,
"runtime": [],
"sources": [
"src.path.0",
"src.path.1",
"src.path.2"
],
"statement": "The fixed PostgreSQL 18.6 source contains the report contexts and message variants described on the page."
}claims · history-boundary
{
"claim_id": "history-boundary",
"limits": "Definition presence is not an emitting-path observation.",
"method": "Compare canonical release facts with the available history boundary.",
"position": 2,
"runtime": [],
"sources": [
"src.errcodes.18.6"
],
"statement": "Locked release definitions establish catalogue presence from 7.4; they do not establish a precise introducing release or runtime use."
}messages · message.pgcrypto-crypt-null
{
"limits": "",
"message_id": "message.pgcrypto-crypt-null",
"path": "",
"position": 0,
"raw": {
"id": "message.pgcrypto-crypt-null",
"primary_template": "crypt(3) returned NULL",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "39000"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "crypt(3) returned NULL",
"position": 0,
"role": "",
"template": "crypt(3) returned NULL"
}
]
}messages · message.pgcrypto-encrypt
{
"limits": "px_strerror(err) text is interpolated into the primary message.",
"message_id": "message.pgcrypto-encrypt",
"path": "",
"position": 1,
"raw": {
"id": "message.pgcrypto-encrypt",
"limits": "px_strerror(err) text is interpolated into the primary message.",
"primary_template": "encrypt error: %s",
"severity_source": "ERROR",
"sources": [
"src.path.0",
"src.path.1"
],
"sqlstate": "39000"
},
"severity": "ERROR",
"sources": [
"src.path.0",
"src.path.1"
],
"templates": [
{
"kind": "primary",
"literal": "encrypt error:",
"position": 0,
"role": "",
"template": "encrypt error: %s"
}
]
}messages · message.pgcrypto-decrypt
{
"limits": "px_strerror(err) text is interpolated into the primary message.",
"message_id": "message.pgcrypto-decrypt",
"path": "",
"position": 2,
"raw": {
"id": "message.pgcrypto-decrypt",
"limits": "px_strerror(err) text is interpolated into the primary message.",
"primary_template": "decrypt error: %s",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "39000"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "decrypt error:",
"position": 0,
"role": "",
"template": "decrypt error: %s"
}
]
}messages · message.pgcrypto-encrypt-iv
{
"limits": "px_strerror(err) text is interpolated into the primary message.",
"message_id": "message.pgcrypto-encrypt-iv",
"path": "",
"position": 3,
"raw": {
"id": "message.pgcrypto-encrypt-iv",
"limits": "px_strerror(err) text is interpolated into the primary message.",
"primary_template": "encrypt_iv error: %s",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "39000"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "encrypt_iv error:",
"position": 0,
"role": "",
"template": "encrypt_iv error: %s"
}
]
}messages · message.pgcrypto-decrypt-iv
{
"limits": "px_strerror(err) text is interpolated into the primary message.",
"message_id": "message.pgcrypto-decrypt-iv",
"path": "",
"position": 4,
"raw": {
"id": "message.pgcrypto-decrypt-iv",
"limits": "px_strerror(err) text is interpolated into the primary message.",
"primary_template": "decrypt_iv error: %s",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "39000"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "decrypt_iv error:",
"position": 0,
"role": "",
"template": "decrypt_iv error: %s"
}
]
}messages · message.pgcrypto-length
{
"limits": "",
"message_id": "message.pgcrypto-length",
"path": "",
"position": 5,
"raw": {
"id": "message.pgcrypto-length",
"primary_template": "Length not in range",
"severity_source": "ERROR",
"sources": [
"src.path.0"
],
"sqlstate": "39000"
},
"severity": "ERROR",
"sources": [
"src.path.0"
],
"templates": [
{
"kind": "primary",
"literal": "Length not in range",
"position": 0,
"role": "",
"template": "Length not in range"
}
]
}messages · message.pgcrypto-library-text
{
"limits": "The dynamic library text is the primary message, not a separate DETAIL field.",
"message_id": "message.pgcrypto-library-text",
"path": "",
"position": 6,
"raw": {
"dynamic_format": "px_strerror(err)",
"id": "message.pgcrypto-library-text",
"limits": "The dynamic library text is the primary message, not a separate DETAIL field.",
"primary_template": "%s",
"severity_source": "ERROR",
"sources": [
"src.path.2"
],
"sqlstate": "39000"
},
"severity": "ERROR",
"sources": [
"src.path.2"
],
"templates": [
{
"kind": "primary",
"literal": "",
"position": 0,
"role": "",
"template": "%s"
}
]
}sources · src.errcodes.18.6
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "src/backend/utils/errcodes.txt",
"position": 0,
"sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
"source_id": "src.errcodes.18.6",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L308"
}sources · src.path.0
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/pgcrypto/pgcrypto.c",
"position": 1,
"sha256": "126e94f378eea1cbf5480ba54dd3deac8c6dd3fe69c43de23efd2f7697f8a932",
"source_id": "src.path.0",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pgcrypto/pgcrypto.c#L234"
}sources · src.path.1
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/pgcrypto/pgp-cfb.c",
"position": 2,
"sha256": "8484871c594a508f85d3f3de69f759e76eb01b7b08c48e72c379887ecf5bdd6a",
"source_id": "src.path.1",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pgcrypto/pgp-cfb.c#L237"
}sources · src.path.2
{
"commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
"docs_url": "",
"kind": "upstream_source",
"location": "",
"path": "contrib/pgcrypto/px.c",
"position": 3,
"sha256": "0cb9fafb3174e8320f4205d58dea5563a4eb4456e85e8a9f7cf5819b8ea5f23e",
"source_id": "src.path.2",
"tag": "REL_18_6",
"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/contrib/pgcrypto/px.c#L105"
}sources · src.calls.REL_18_6
{
"commit": "",
"docs_url": "",
"kind": "local_artifact",
"location": "",
"path": "raw/calls/REL_18_6.jsonl",
"position": 4,
"sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
"source_id": "src.calls.REL_18_6",
"tag": "",
"url": ""
}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · english-manuals:c78319705671d97dfeb0898108eff8e8cbff313c9b3ccfdcec3ebb440e0a06c3
Text language: en · english-manuals:c78319705671d97dfeb0898108eff8e8cbff313c9b3ccfdcec3ebb440e0a06c3