Skip to content
Assay

Reference

Issue codes

Match on the code, never on the message: the wording is not part of the API, the code is. Every code is also a static on IssueCode in camelCase — too_small is IssueCode.tooSmall.

Parameters named in a meaning are in issue.params, ready to interpolate into your own wording.

Code Meaning
invalid_escape A string escape that is not one: a lone surrogate, a non-hex \u digit. location is the backslash. “contains an invalid escape sequence”.
assayer_conversion_failed The value was accepted by the schema but refused by its conversion.
fallback_applied Fell back to the declared value.
alias_matched Was read from its alias “…”. A warning: the field decoded from a @Key(_:or:) alias rather than its primary key. Params: alias.
invalid_regex_pattern The rule’s pattern … is not a valid regular expression. Params: pattern.
regex_unavailable Regular expressions are not available on this platform version.
unknown_variant Params: options.
Code Meaning
empty Must not be empty.
invalid_email Must be a valid email address.
invalid_hostname Must be a valid hostname.
invalid_url Must be a valid URL.
invalid_uuid Must be a valid UUID.
missing_prefix Must start with “…”. Params: prefix.
missing_substring Must contain “…”. Params: substring.
missing_suffix Must end with “…”. Params: suffix.
negative Must not be negative.
not_ascii Must contain only ASCII characters.
not_finite Must be a finite number.
not_in_range Must be between … and …. Params: maximum, minimum.
not_lowercased Must be lowercase.
not_multiple Must be a multiple of …. Params: multipleOf.
not_negative Must be negative.
not_one_of Must be one of …. Params: options.
not_positive Must be positive.
not_trimmed Must not have leading or trailing whitespace.
not_unique Must not contain duplicates.
pattern_mismatch Must match the pattern …. Params: pattern.
too_large Must be at most …. Params: maximum.
too_small Must be at least …. Params: minimum.
wrong_count Must contain between … and … items. Params: maximum, minimum.
wrong_length Must be exactly … character… ? . Params: length.
Code Meaning
date_format_fallback Matched the fallback format …, . Params: matched, primary.
date_not_after Must be after …. Params: bound.
date_not_before Must be before …. Params: bound.
date_not_between Must be between … and …. Params: maximum, minimum.
invalid_date Params: expected, reason.
invalid_rule_date The rule’s date bound “…” is not a valid ISO-8601 date. Params: bound.
Code Meaning
union_budget_exhausted Union backtracking exceeded … attempts (Limits.maxUnionAttempts). Params: maxUnionAttempts.
union_no_variant_matched Params: closest, type, variants.
union_unknown_variant Params: didYouMean, known.
Code Meaning
extras_key_collision Extras key “…” collides with a declared field. Params: key.
unknown_not_encodable Params: type.
unrepresentable_value Cannot be represented in … (…). Params: format.
Code Meaning
missing_content_type Content-Type …. Params: reason.
unreadable_charset Params: charset, reason.
unsupported_media_type Media type … is not in the accepted list.
Code Meaning
cannot_map_file Could not open or map the file.
Code Meaning
plist_amplification Property list: …. Params: reason.
plist_bad_date —
plist_bad_magic —
plist_bad_marker —
plist_bad_offset —
plist_bad_real —
plist_bad_reference —
plist_bad_root —
plist_bad_string —
plist_bad_trailer —
plist_bad_value —
plist_cycle Property list: …. Params: reason.
plist_int_out_of_range —
plist_int_too_wide —
plist_too_deep Property list nests deeper than … levels (Limits.maxDepth). Params: maxDepth.
plist_truncated —
plist_unpaired_key —
plist_unrepresentable_key —
Code Meaning
toml_bad_date_time Invalid date-time.
toml_bad_escape Invalid escape sequence.
toml_bad_number Invalid number literal.
toml_control_character Control characters must be escaped.
toml_expected_equals Expected ‘=’ after the key.
toml_expected_key Expected a key.
toml_expected_newline Expected a newline after the value.
toml_expected_value Expected a value.
toml_inline_table_closed Inline table ‘…’ cannot be extended after it is defined. Params: key.
toml_no_null TOML has no null; the value cannot be encoded. Encoding only.
toml_not_a_table ‘…’ is not a table and cannot be extended. Params: key.
toml_redefined_table Table ‘…’ is already defined. Params: key.
toml_root_not_a_table A TOML document is a table; the root value is not. Encoding only.
toml_unterminated_array Unterminated array; expected ‘,’ or ‘]’.
custom toml_unterminated_inline_table — “unterminated inline table; expected ‘,’ or ‘}’”.
toml_unterminated_string Unterminated string.
custom toml_unterminated_table_header — “expected ‘]’ closing the table header”.
Code Meaning
yaml_anchor_on_alias An anchor cannot be placed on an alias (&a *b); an alias refers to an anchored node and is not a node of its own.
yaml_bad_escape Invalid escape sequence.
yaml_empty_stream The stream contains no documents.
yaml_expansion_limit Alias expansion limit exceeded.
yaml_expected_colon Expected ‘:’ after mapping key.
yaml_expected_value_indicator Expected ‘:’ introducing the value.
yaml_multiple_documents The stream contains multiple documents; use parseAll.
yaml_undefined_alias Alias refers to an undefined anchor.
yaml_unexpected_in_flow Unexpected character in a flow collection; expected ‘,’ or a closing bracket.
yaml_unrepresentable_key A mapping key is not a plain scalar; parse to YAML.Node instead.
custom yaml_unterminated_flow_mapping — “unterminated flow mapping”.
custom yaml_unterminated_flow_sequence — “unterminated flow sequence”.
custom yaml_unterminated_quoted_scalar — “unterminated quoted scalar”.
Code Meaning
xml_bad_attribute_name Invalid attribute name.
xml_bad_character_reference Invalid character reference.
xml_bad_name Invalid name.
xml_bad_pi_target Invalid processing instruction target.
xml_entity_expansion_limit Entity expansion limit exceeded.
xml_expected_equals Expected ‘=’ after attribute name.
xml_external_dtd_ignored External DTD subset ignored (never fetched).
xml_external_entity_ignored External entity ignored (never fetched).
xml_mismatched_tag Closing tag does not match.
xml_no_root Document has no root element.
xml_raw_lt_in_attribute ‘<’ is not allowed in an attribute value.
xml_recursive_entity Entity &…; refers to itself. Params: entity.
xml_root_mismatch Root element must be <…>, found <…>. Params: expected.
xml_unclosed_element Element is never closed.
xml_undeclared_entity Reference to an undeclared entity.
xml_unquoted_attribute Attribute value must be quoted.
xml_unterminated_attribute Unterminated attribute value.
xml_unterminated_cdata Unterminated CDATA section.
xml_unterminated_comment Unterminated comment.
xml_unterminated_doctype Unterminated DOCTYPE.
xml_unterminated_entity Unterminated entity reference.
xml_unterminated_pi Unterminated processing instruction.
xml_unterminated_tag Unterminated tag.