fern/03-reference/baml_client/errors/baml-validation-error.mdx
The BamlValidationError class represents an error that occurs when BAML fails to parse or validate LLM output.
<ParamField path="type" type="'BamlValidationError'"
Literal type identifier for the error class. </ParamField>
<ParamField path="message" type="string"
Error message describing the specific validation failure. </ParamField>
<ParamField path="prompt" type="string"
The original prompt sent to the LLM. </ParamField>
<ParamField path="raw_output" type="string"
The raw output from the LLM that failed validation. </ParamField>
<ParamField path="detailed_message" type="string"
Comprehensive error information that includes the complete history of all failed attempts when using fallback clients or retry policies. When multiple attempts are made (via fallback or retry), this field contains formatted details about each failed attempt, making it invaluable for debugging complex client configurations. </ParamField>
The error can be identified using TypeScript's instanceof operator: