FHIRPath: Unexpected Character at Position
The lexer hit a character that is not part of the FHIRPath token alphabet at the given position, so it could not even tokenize the expression.
FHIRPath · Error
The error
Unexpected characterWhy it happens
Pasting in a smart quote or non-ASCII punctuation, a stray control character, or a currency or symbol that FHIRPath does not use.
How to fix it
Remove or replace the offending character at the reported position. Re-type quotes as plain ASCII single quotes. Smart quotes copied from a document are a frequent culprit.
Example
The snippet below triggers the error:
Patient.name.where(use = ‘official’)The corrected version:
Patient.name.where(use = 'official')Frequently asked questions
Why does my pasted expression fail but a retyped one works?
Word processors and chat apps often substitute curly smart quotes for straight quotes. FHIRPath only accepts straight ASCII quotes, so a pasted curly quote triggers an unexpected-character error.