Skip to main content

Module code

Module code 

Source
Expand description

Stable Y#### diagnostic codes and the single code registry.

§Allocation rules

RangeArea
Y0001–Y0999syntax: decode, lex, parse, recovery
Y1000–Y1999schema & resolution: directives, tags, duplicate keys, settings conflicts
Y2000–Y2999limits
Y3000–Y3999serde
Y9000–Y9999reserved; Y9000 = internal error

Y0000 is never used. Codes are allocated sequentially within their range, only in this file: a new code is max + 1 of its range, added as a constant plus a matching REGISTRY entry.

The registry is append-only. A code is never removed, reused, renumbered, renamed, or given a new meaning. To retire a code, set CodeInfo::deprecated; the entry stays forever, so ranges stay contiguous. crates/oneyaml-core/tests/codes.snapshot freezes every entry (code, name, severity, status, summary) and a test compares the registry with it, so any change to an existing entry shows up as a snapshot diff in review.

Structs§

Code
A stable diagnostic code, rendered as Y####.
CodeInfo
One registry entry.

Enums§

CodeRange
The area a Code belongs to.

Constants§

ALIAS_BUDGET_EXCEEDED
Alias expansion (including merge keys through aliases) produced more nodes than Limits::alias_budget allows; Value and serde only. Error.
ALIAS_BYTE_BUDGET_EXCEEDED
Alias expansion materialised more bytes than Limits::alias_byte_budget allows: scalar text, keys, and tags copied by expansion (merge keys through aliases included), each tag use’s %TAG prefix, and %TAG tags joined into enum variant names; Value and serde only. Error.
ALIAS_WITH_PROPERTIES
An alias node with an anchor or tag (production 104). Error.
BLOCK_COLLECTION_NOT_ALLOWED
A block sequence or mapping starting on a line where only a scalar may start, e.g. after ---, after an implicit key’s :, or after properties (production 200). Error.
BLOCK_SCALAR_INDENTATION
A leading empty line of an auto-indented block scalar has more spaces than its first content line (§8.1.1.1). Error.
COLLECTION_TAG_ON_SCALAR
A collection tag (!!seq, !!map) on a scalar node (§10). Error.
CONTENT_AFTER_DOCUMENT
Content after a document’s root node, or after a ... marker on the same line (§9.1). Error.
CUSTOM
A custom error raised by the target type’s Deserialize impl. Error.
DEPTH_LIMIT_EXCEEDED
Collections nested deeper than Limits::max_depth (block and flow nesting combined). Error.
DIAGNOSTICS_SUPPRESSED
More diagnostics than Limits::max_diagnostics were found: the list ends with this one summary, “N more diagnostics suppressed”, located where the first suppressed one was. Not a problem of the input by itself: a warning, so a strict parse still fails only at an error. Warning.
DIRECTIVE_IN_DOCUMENT
A directive inside a document that was not ended with ... (production 211). Error.
DIRECTIVE_WITHOUT_DOCUMENT
Directives not followed by an explicit --- (productions 210-211). Error.
DOCUMENT_TOO_LARGE
Input larger than Limits::max_document_size bytes. Error.
DOCUMENT_UNAVAILABLE
A document of a multi-document Deserializer used after the stream moved past it, or twice. Error.
DUPLICATE_DIRECTIVE
A second %YAML directive, or a %TAG handle declared twice, for one document (§6.8.1, §6.8.2). Error.
DUPLICATE_FIELD
A struct field given twice (as two keys that differ in YAML but name the same field). Error.
DUPLICATE_KEY
A mapping key that is equal to an earlier key of the same mapping (§3.2.1.1). Error.
DUPLICATE_KEY_LAST_WINS
A duplicate mapping key tolerated by DuplicateKeys::LastWins: the last value wins; a secondary label points at the first definition. Warning.
DUPLICATE_PROPERTY
A node with two anchors or two tags (production 96). Error.
IMPLICIT_KEY_TOO_LONG
An implicit key (with its properties and trailing white space) longer than 1024 characters (productions 154-155, §8.2.2). Error.
INCORRECT_SETTINGS
A combination of settings that would produce incorrect results. Error.
INLINE_COLON_IN_PLAIN_VALUE
A : inside an unquoted (plain) scalar that is the value of a block mapping entry, on the entry’s line, e.g. title: The farm: a banana story. The : would start a nested mapping, which cannot begin on that line (production 200). A more specific diagnosis of the case that earlier parser versions reported as BLOCK_COLLECTION_NOT_ALLOWED; carries a machine-applicable fix that quotes the value. Error.
INTEGER_OUT_OF_RANGE
An integer outside the range of the target integer type. Error.
INTERNAL_ERROR
An internal invariant of the library was violated: the release-build outcome of a debug_assert!, reported in-band (an error event, or Err(Internal)) instead of a silently wrong result. Always a bug in oneyaml; please report it with the input. Error.
INVALID_ANCHOR
An empty or malformed anchor or alias name (production 102). Error.
INVALID_BLOCK_HEADER
A malformed block scalar header: an indentation indicator of 0, a repeated indicator, or text after the header (production 162). Error.
INVALID_ESCAPE
An invalid escape sequence in a double-quoted scalar (§5.7). Error.
INVALID_EVENT_STREAM
A caller-supplied event stream violates the event contract, e.g. one passed to SyntaxTree::from_events after filtering or reordering the parser’s events. API misuse, not a bug in oneyaml: the result is built without panicking but may not round-trip. Error.
INVALID_INDENTATION
A line indented so that it belongs to no open block collection (§8.2). Error.
INVALID_LENGTH
A sequence or mapping with a length the target type does not accept, e.g. a tuple of the wrong arity. Error.
INVALID_MERGE_VALUE
A merge key (<<, with merge_keys on) whose value is not a mapping or a sequence of mappings (yaml.org/type/merge). Error.
INVALID_NODE_START
A character that cannot start a node (§7.3.3, production 126). Error.
INVALID_QUOTED_CHARACTER
A character outside nb-json (production 2), i.e. a C0 control other than tab, inside a quoted scalar (§7.3). Error.
INVALID_SCALAR_FOR_TAG
An explicitly tagged scalar whose text is not a valid form of its core tag under the active schema, e.g. !!int twelve (§10). Error.
INVALID_SERIALIZE_CALLS
A Serialize impl drove the serializer out of order, e.g. a map value without its key, or a key without a value. Error.
INVALID_TAG
A malformed tag property (§6.9.1). Error.
INVALID_UTF8
Bytes that are not valid UTF-8 in input decoded as UTF-8 (§5.2). Each maximal invalid run is replaced by U+FFFD. Error.
INVALID_UTF16
Input decoded as UTF-16 with an unpaired surrogate or a trailing odd byte (§5.2). Each maximal invalid run is replaced by U+FFFD. Error.
INVALID_UTF32
Input decoded as UTF-32 with a code unit that is not a Unicode scalar value, or trailing bytes that do not form a code unit (§5.2). Each maximal invalid run is replaced by U+FFFD. Error.
INVALID_VALUE
A value of the right type that the target type rejects. Error.
IO_ERROR
Reading the input failed (from_reader). Error.
JSON_DEPTH_EXCEEDED
A Value converted to a serde_json::Value (feature serde_json) nests deeper than 128 levels. The bound is fixed, whatever Limits say: serde_json’s recursion limit, and its Value drops recursively. Error.
JSON_UNMATCHED_SCALAR
JSON schema: a plain scalar matching none of the JSON patterns (§10.2.2). Error.
LENIENT_INLINE_COLON
The input of INLINE_COLON_IN_PLAIN_VALUE was read as one string because the lenient_inline_colons setting is on. Warning.
MALFORMED_DIRECTIVE
A %YAML/%TAG directive with missing, extra, or malformed parameters, or a directive without a name (§6.8). Error.
MEANINGLESS_SETTINGS
A combination of settings in which a setting has no effect. Warning.
MISPLACED_BYTE_ORDER_MARK
A byte order mark (U+FEFF) where YAML 1.2.2 does not allow one (§5.2, productions 27, 202, 211). A mark is allowed only at the very start of a line that starts a document prefix: the start of the stream, after a ... line, or after a complete document (whose end it then marks; only a document starting with --- may follow it). It is also allowed inside quoted scalars, whose nb-json characters include it.
MISSING_FIELD
A mapping without a field the target struct requires. Error.
MISSING_FLOW_SEPARATOR
Two flow collection entries without a , between them (productions 138, 141). Error.
MISSING_MAPPING_COLON
A block mapping entry without its : value indicator (production 192). Error.
MULTILINE_IMPLICIT_KEY
An implicit mapping key spanning more than one line (production 154). Error.
MULTIPLE_DOCUMENTS
A single-document entry point (from_str, …) given a stream with more than one document; use the multi-document Deserializer. Error.
QUOTED_SCALAR_INDENTATION
A continuation line of a quoted scalar indented too little (production 69). Error.
READ_AFTER_IGNORED_ERROR
A Deserialize impl ignored an error that oneyaml returned for a sequence or mapping it had started to read, then went on reading: the rest of that node was never read, so nothing after it can be read in step. Reported at the next read, or at the end of the document, located at the node whose error was ignored; the same for from_str and from_value. Propagate the error instead (?). Error.
REGISTRY
Every allocated code, in numeric order.
RESERVED_DIRECTIVE_IGNORED
A reserved directive (%NAME other than YAML/TAG) was ignored (YAML 1.2.2 §6.8). Warning.
SCALAR_TOO_LONG
A scalar value longer than Limits::max_scalar_len bytes. Error.
SERIALIZE_CUSTOM
A custom error raised by the value’s Serialize impl (serde::ser::Error::custom). Error.
SERIALIZE_DUPLICATE_KEY
A mapping being serialized has two equal keys (e.g. a struct field and a flattened map entry with the same name); YAML 1.2 requires unique keys, so the output would not read back. Error.
TAB_INDENTATION
A tab character used as block indentation (§6.1). Error.
THREAD_LOCAL_UNAVAILABLE
A Value was serialized or deserialized by oneyaml’s own Serializer or Deserializer from a thread-local destructor after oneyaml’s own thread-local storage on that thread was destroyed: the value cannot be handed over between the Value and oneyaml (an error, never a panic or a wrong or lossy value). Serialize or deserialize before the thread shuts down (or deserialize into a typed target). Error.
TOO_MANY_DOCUMENTS
A stream with more documents than Limits::max_documents. Error.
TREE_CAPACITY_EXCEEDED
Input with more elements (nodes, tokens, trivia) than a syntax tree’s u32 indices can address; the rest of the input is kept as skipped bytes, so the tree still round-trips. Error.
TYPED_DEPTH_EXCEEDED
Deserializing into a recursive user type (e.g. struct Tree(Vec<Tree>)) nested deeper than Limits::max_typed_depth. serde’s visitor model recurses once per level of such a type, so this bounds the native stack; Value targets are iterative and bounded only by max_depth. Also Serialize for Value into third-party serializers, which recurse once per level: values deeper than the default max_typed_depth (128) are refused. Error.
TYPE_MISMATCH
A node’s type does not fit the target type, e.g. a mapping for a String, or a quoted scalar for a number. Error.
UNDEFINED_ALIAS
An alias whose anchor is not defined earlier in the document, or whose anchored node is not complete yet (a recursive alias) (§7.1). Error.
UNDEFINED_TAG_HANDLE
A named tag handle (!e!) not declared by a %TAG directive of its document (§6.8.2.1). Error.
UNEXPECTED_CONTENT
Unexpected content after a complete node on the same line. Error.
UNEXPECTED_FLOW_INDICATOR
A ,, ], or } where it cannot appear, e.g. a leading or doubled ,, or a mismatched closing bracket (§7.4). Error.
UNKNOWN_FIELD
A mapping key the target struct does not accept (deny_unknown_fields). Error.
UNKNOWN_VARIANT
An enum variant name the target enum does not have. Error.
UNREPRESENTABLE_VALUE
A value YAML output cannot represent so that it reads back as the same value: an empty or malformed tag, a tag on a tagged value, or a custom tag on a non-string scalar (a custom-tagged scalar always reads back as a string). Error.
UNSUPPORTED_SETTING
A setting this version cannot honour, e.g. Emit::line_width(Some(_)) (line wrapping is not implemented): refused rather than silently ignored. Error.
UNSUPPORTED_SYNTAX
Syntax this parser version does not implement yet. Deprecated: used only for flow collections and block scalars by pre-release parsers that did not implement them; never emitted any more. Error.
UNTERMINATED_FLOW_COLLECTION
A flow collection not closed before the end of input or a document marker (§7.4). Error.
UNTERMINATED_QUOTED_SCALAR
A quoted scalar not closed before the end of input or a document marker (§7.3). Error.
VALUE_DEPTH_EXCEEDED
A Value consumed by the library (serialized, or deserialized into a type) nests deeper than Limits::max_depth. Error.
WRITE_ERROR
Writing the output failed (to_writer, Serializer). Error.
WRONG_TAG_ON_COLLECTION
A core tag that does not match the collection it is on, e.g. !!str [a] or !!map [a] (§10). Error.
YAML_VERSION_1_0
A %YAML 1.0 directive. By default the document is parsed as YAML 1.2; under honor_version_directive the YAML 1.1 preset applies, as for 1.1. The message says which. Warning.
YAML_VERSION_1_1
A %YAML 1.1 directive. By default the document is parsed as YAML 1.2; under honor_version_directive the YAML 1.1 preset applies. The message says which. Warning.
YAML_VERSION_NEWER_MINOR
%YAML 1.x with x > 2: processed as YAML 1.2. Warning.
YAML_VERSION_UNSUPPORTED_MAJOR
%YAML with a major version other than 1. Error.