Expand description
Stable Y#### diagnostic codes and the single code registry.
§Allocation rules
| Range | Area |
|---|---|
Y0001–Y0999 | syntax: decode, lex, parse, recovery |
Y1000–Y1999 | schema & resolution: directives, tags, duplicate keys, settings conflicts |
Y2000–Y2999 | limits |
Y3000–Y3999 | serde |
Y9000–Y9999 | reserved; 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§
Enums§
Constants§
- ALIAS_
BUDGET_ EXCEEDED - Alias expansion (including merge keys through aliases) produced more
nodes than
Limits::alias_budgetallows;Valueand serde only. Error. - ALIAS_
BYTE_ BUDGET_ EXCEEDED - Alias expansion materialised more bytes than
Limits::alias_byte_budgetallows: scalar text, keys, and tags copied by expansion (merge keys through aliases included), each tag use’s%TAGprefix, and%TAGtags joined into enum variant names;Valueand 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
Deserializeimpl. Error. - DEPTH_
LIMIT_ EXCEEDED - Collections nested deeper than
Limits::max_depth(block and flow nesting combined). Error. - DIAGNOSTICS_
SUPPRESSED - More diagnostics than
Limits::max_diagnosticswere 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_sizebytes. Error. - DOCUMENT_
UNAVAILABLE - A document of a multi-document
Deserializerused after the stream moved past it, or twice. Error. - DUPLICATE_
DIRECTIVE - A second
%YAMLdirective, or a%TAGhandle 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 asBLOCK_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, orErr(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_eventsafter 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 (
<<, withmerge_keyson) 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
Serializeimpl 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
Valueconverted to aserde_json::Value(featureserde_json) nests deeper than 128 levels. The bound is fixed, whateverLimitssay: serde_json’s recursion limit, and itsValuedrops 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_VALUEwas read as one string because thelenient_inline_colonssetting is on. Warning. - MALFORMED_
DIRECTIVE - A
%YAML/%TAGdirective 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, whosenb-jsoncharacters 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-documentDeserializer. Error. - QUOTED_
SCALAR_ INDENTATION - A continuation line of a quoted scalar indented too little (production 69). Error.
- READ_
AFTER_ IGNORED_ ERROR - A
Deserializeimpl 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 forfrom_strandfrom_value. Propagate the error instead (?). Error. - REGISTRY
- Every allocated code, in numeric order.
- RESERVED_
DIRECTIVE_ IGNORED - A reserved directive (
%NAMEother thanYAML/TAG) was ignored (YAML 1.2.2 §6.8). Warning. - SCALAR_
TOO_ LONG - A scalar value longer than
Limits::max_scalar_lenbytes. Error. - SERIALIZE_
CUSTOM - A custom error raised by the value’s
Serializeimpl (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
Valuewas serialized or deserialized by oneyaml’s ownSerializerorDeserializerfrom a thread-local destructor after oneyaml’s own thread-local storage on that thread was destroyed: the value cannot be handed over between theValueand 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
u32indices 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 thanLimits::max_typed_depth. serde’s visitor model recurses once per level of such a type, so this bounds the native stack;Valuetargets are iterative and bounded only bymax_depth. AlsoSerialize for Valueinto third-party serializers, which recurse once per level: values deeper than the defaultmax_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%TAGdirective 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
Valueconsumed by the library (serialized, or deserialized into a type) nests deeper thanLimits::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.0directive. By default the document is parsed as YAML 1.2; underhonor_version_directivethe YAML 1.1 preset applies, as for 1.1. The message says which. Warning. - YAML_
VERSION_ 1_ 1 - A
%YAML 1.1directive. By default the document is parsed as YAML 1.2; underhonor_version_directivethe YAML 1.1 preset applies. The message says which. Warning. - YAML_
VERSION_ NEWER_ MINOR %YAML 1.xwithx > 2: processed as YAML 1.2. Warning.- YAML_
VERSION_ UNSUPPORTED_ MAJOR %YAMLwith a major version other than 1. Error.