Skip to content
Error Reference

Error Reference

The GoFHIR Validator produces structured validation issues that are aligned with the output of the HL7 FHIR Validator. Every issue includes a machine-readable message ID, a severity level, a human-readable diagnostic, and the FHIRPath expression that identifies the offending element.

Issue Structure

Each validation issue contains the following fields:

FieldTypeDescription
Severityerror | warning | informationHow critical the issue is
CodestringThe FHIR issue type (e.g., structure, value, processing)
DiagnosticsstringA human-readable description of the problem
Expressionstring[]FHIRPath expression(s) pointing to the element
MessageIDstringA stable, machine-readable identifier for the error

Example issue in JSON (OperationOutcome format):

{
  "severity": "error",
  "code": "value",
  "diagnostics": "Value 'not-a-date' is not a valid date format",
  "expression": ["Patient.birthDate"],
  "details": {
    "text": "TYPE_INVALID_DATE"
  }
}

Message Placeholders

Diagnostic messages use placeholders that are replaced with context-specific values at runtime:

PlaceholderDescriptionExample
{path}FHIRPath to the elementPatient.identifier
{value}The actual value foundnot-a-date
{expected}The expected value or typedateTime
{min}Minimum cardinality or count1
{max}Maximum cardinality or count1
{count}Actual count found0
{type}The data type encounteredstring
{element}The element nameunknownField
{valueSet}ValueSet URLhttp://hl7.org/fhir/ValueSet/gender
{constraint}Constraint keyele-1
{profile}Profile URLhttp://hl7.org/fhir/StructureDefinition/Patient
{system}Code system URLhttp://loinc.org
{url}Extension or resource URLhttp://example.org/ext
{error}Underlying error messageunexpected token
{human}Human-readable constraint textAll FHIR elements must have a @value or children
{slice}Slice nameObservation.component:diastolic
Programmatic error handling. Use the MessageID field to identify specific errors in your code rather than parsing the diagnostic text. Message IDs are stable across releases and are not affected by wording changes in diagnostic messages.

Error Categories

Browse the error reference by category:

Last updated on