select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 38 · EXTERNAL ROUTINE EXCEPTION

external_routine_exception

SQLSTATE
38000
Condition name
external_routine_exception
Class
External Routine Exception
Source macro
ERRCODE_EXTERNAL_ROUTINE_EXCEPTION
Evidence
Source path confirmed
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>38000</h1>

At a glance

Class 38 is broad. Fixed PostgreSQL 18.6 paths include external command failures in COPY ... PROGRAM and basebackup_to_shell, UUID library failures, and exceptions propagated from PL/Perl, PL/Python, and PL/Tcl. These are separate implementations under one category.

Meaning

Representative messages include program "%s" failed and shell command "%s" failed, each with an internal wait-status detail; OSSP uuid library failure: %s, OSSP uuid library failure: error code %d, uuid library failure: %d, and the UUID version-mismatch message; PL/Perl reports such as didn't get a return item from function, PL/Python forwards %s with optional detail/context/hint, and PL/Tcl reports could not parse function return value: %s or a context-bearing %s. Keep the dynamic fields and the actual producer; this category has no single fixed message.

Messages

Representative messages include program "%s" failed and shell command "%s" failed, each with an internal wait-status detail; OSSP uuid library failure: %s, OSSP uuid library failure: error code %d, uuid library failure: %d, and the UUID version-mismatch message; PL/Perl reports such as didn't get a return item from function, PL/Python forwards %s with optional detail/context/hint, and PL/Tcl reports could not parse function return value: %s or a context-bearing %s. Keep the dynamic fields and the actual producer; this category has no single fixed message.

Diagnosis

Use the message and context to identify the external boundary: program path and wait result, UUID library operation, or PL language and routine. Inspect the relevant server configuration and handler logs, preserving dynamic %s values and any internal detail.

Response

Repair the named external command, library, or language routine and verify that boundary independently. A failed external action may have side effects; do not replay it until completion and idempotency are known.

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.

Sources

Read the fixed basebackup_to_shell.c, copyto.c, uuid-ossp.c, plperl.c, and pltcl.c paths alongside the structured evidence record.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

38000 is external_routine_exception in SQLSTATE Class 38.

Method: Read the fixed errcodes definition row, severity, and macro.

src.errcodes.18.6

The fixed PostgreSQL 18.6 source contains the external-command, UUID-library, and PL/Perl, PL/Python, PL/Tcl report contexts and message variants described on the page.

Method: Read the complete source context around the resolved report groups.

Limits: Source confirmation is not a runtime observation in this batch.

src.path.0 src.path.1 src.path.2 src.path.3 src.path.4 src.path.5 src.path.6

Locked release definitions establish catalogue presence from 7.4; they do not establish a precise introducing release or runtime use.

Method: Compare canonical release facts with the available history boundary.

Limits: Definition presence is not an emitting-path observation.

src.errcodes.18.6

Message templates

ERROR · message.basebackup-shell-failed

Primary

shell command "%s" failed

Detail

%s

The command and internal wait-status detail are dynamic.

ERROR · message.copy-program-failed

Primary

program "%s" failed

Detail

%s

The program path and internal wait-status detail are dynamic.

ERROR · message.uuid-library-text

Primary

OSSP uuid library failure: %s

The external UUID library text is interpolated into the primary message.

ERROR · message.uuid-library-code

Primary

OSSP uuid library failure: error code %d

The external UUID status code is dynamic.

ERROR · message.uuid-library-code-short

Primary

uuid library failure: %d

The UUID library status value is dynamic; this branch is used by the uuid-ossp fallback path.

ERROR · message.uuid-version-mismatch

Primary

uuid_create() produced a version %c UUID instead of the expected version 1

The UUID version character is dynamic.

ERROR · message.plperl-no-return-item

Primary

didn't get a return item from function
caller-selected level · message.plpython-forwarded-diagnostics

PL/Python forwards the underlying dynamic message and optional DETAIL, CONTEXT, and HINT; no single static primary template is asserted.

ERROR · message.pltcl-return-parse

Primary

could not parse function return value: %s

The parse error text is dynamic.

ERROR · message.pltcl-context

Primary

%s

Context

%s
in PL/Tcl function %s

Both error text and function name are dynamic.

Reproduction & repair cases

No reproduction case is attached to this condition.

Recorded runtime evidence

No runtime observation is attached to this entry.

Definition snapshot: english-manuals:e00182a038422b9854bd40d3e7a… · English manual source