Resource id Has an Invalid Format
A FHIR logical id may contain only letters, digits, hyphens, and dots, and must be 1 to 64 characters long. The supplied id breaks one of those rules.
FHIR · Error
The error
id must match [A-Za-z0-9-.]{1,64}Why it happens
Using an underscore, slash, or space in the id, exceeding 64 characters, or accidentally putting a full URL or a Type/id reference in the id field.
How to fix it
Restrict the id to [A-Za-z0-9-.] and keep it at most 64 characters. Replace underscores and spaces with hyphens. The id is the bare logical id, not a reference path.
Example
The snippet below triggers the error:
{
"resourceType": "Patient",
"id": "patient_001 (active)"
}The corrected version:
{
"resourceType": "Patient",
"id": "patient-001"
}Frequently asked questions
Can a FHIR id contain an underscore?
No. The FHIR id type allows only letters, digits, hyphen, and dot. Underscores, slashes, and spaces are not permitted. Replace them with a hyphen.
Related
- Open the FHIR Validator
- All validation errors
- resourceType Is Required
- Unknown FHIR R4 Resource Type
- Required Element Is Missing for This Resource
- gender Must Be male, female, other, or unknown
- birthDate Must Be YYYY, YYYY-MM, or YYYY-MM-DD
- instant Must Include a Timezone
- subject Must Be a Reference Object, Not a String
- Reference Should Be Type/id, urn:uuid, or an Absolute URL