pub enum Error {
Show 43 variants
BitStreamTruncated {
requested: usize,
available: usize,
},
WireVersionMismatch {
got: u8,
},
MalformedHeader {
detail: String,
},
PathDepthExceeded {
got: usize,
max: usize,
},
KeyCountOutOfRange {
n: u8,
},
DivergentPathCountMismatch {
n: u8,
got: usize,
},
AltCountOutOfRange {
got: usize,
},
TagOutOfRange {
primary: u8,
},
ThresholdOutOfRange {
k: u8,
},
ChildCountOutOfRange {
count: usize,
},
KGreaterThanN {
k: u8,
n: usize,
},
TlvOrderingViolation {
prev: u8,
current: u8,
},
PlaceholderIndexOutOfRange {
idx: u8,
n: u8,
},
OverrideOrderViolation {
prev: u8,
current: u8,
},
EmptyTlvEntry {
tag: u8,
},
TlvLengthExceedsRemaining {
length: usize,
remaining: usize,
},
PlaceholderNotReferenced {
idx: u8,
n: u8,
},
PlaceholderFirstOccurrenceOutOfOrder {
expected_first: u8,
got_first: u8,
},
MultipathAltCountMismatch {
expected: usize,
got: usize,
},
ForbiddenTapTreeLeaf {
tag: u8,
},
OperatorContextViolation {
tag: Tag,
context: ContextKind,
},
ChunkCountOutOfRange {
count: u8,
},
ChunkIndexOutOfRange {
index: u8,
count: u8,
},
ChunkSetIdOutOfRange {
id: u32,
},
ChunkHeaderChunkedFlagMissing,
ChunkCountExceedsMax {
needed: usize,
},
Codex32DecodeError(String),
Codex32EncodeError(String),
ChunkSetEmpty,
ChunkSetInconsistent,
ChunkSetIncomplete {
got: usize,
expected: usize,
},
ChunkIndexGap {
expected: u8,
got: u8,
},
ChunkSetIdMismatch {
expected: u32,
derived: u32,
},
VarintOverflow {
value: u32,
},
MissingExplicitOrigin {
idx: u8,
},
InvalidPresenceByte {
reserved_bits: u8,
},
InvalidXpubBytes {
idx: u8,
},
MissingPubkey {
idx: u8,
},
ChainIndexOutOfRange {
chain: u32,
alt_count: usize,
},
HardenedPublicDerivation,
AddressDerivationFailed {
detail: String,
},
NUMSSentinelConflict,
DecodeRecursionDepthExceeded {
depth: u8,
max: u8,
},
}Expand description
Errors produced by md-codec wire-format components.
Variants§
BitStreamTruncated
A read of requested bits was attempted but only available bits remained.
Fields
WireVersionMismatch
Wire-format version field doesn’t match v0.30 (=4). Returned when a payload or chunk-header is read with a version value outside the accepted v0.30 set. Per SPEC v0.30 §2.4 + §2.5 + §11.1.
MalformedHeader
Header malformed in a way other than version mismatch — e.g., chunked- flag inconsistent with caller context, or chunk-header internal field out of range. Per SPEC v0.30 §11.1.
PathDepthExceeded
Path depth exceeds MAX_PATH_COMPONENTS (15).
KeyCountOutOfRange
Key count n out of range. Per SPEC v0.30 §4: 1 ≤ n ≤ 32.
DivergentPathCountMismatch
Divergent path count doesn’t match key count.
AltCountOutOfRange
Multipath alt-count out of range. Per SPEC v0.30 §8: 2 ≤ count ≤ 9.
TagOutOfRange
Tag value outside the allocated v0.30 set: 6-bit primary in reserved
range 0x24..=0x3E, or extension prefix 0x3F followed by an unrecognized
4-bit subcode 0x00..=0x0F (the entire extension subspace is reserved
in v0.30). primary carries the raw 6-bit value read off the wire
(0x3F for extension-subspace failures); the 4-bit subcode is consumed
but not reported. Per SPEC v0.30 §3.2 and §11.1.
ThresholdOutOfRange
Threshold k out of range. Per SPEC v0.30 §4: 1 ≤ k ≤ 32.
ChildCountOutOfRange
Variable-arity child count out of range. Per SPEC v0.30 §4: 1 ≤ count ≤ 32.
KGreaterThanN
k > n in k-of-n threshold/multisig.
TlvOrderingViolation
TLV ordering violation: a TLV tag was followed by a smaller-or-equal tag.
PlaceholderIndexOutOfRange
Placeholder index in TLV entry exceeds key count n.
OverrideOrderViolation
Per-@N override entries within a TLV must be in ascending @N-index order.
EmptyTlvEntry
TLV entry has zero entries; encoder MUST omit empty TLVs per spec §7.5.
TlvLengthExceedsRemaining
TLV length exceeds remaining bits in stream.
PlaceholderNotReferenced
Placeholder @i was not referenced anywhere in the tree (BIP 388 well-formedness).
PlaceholderFirstOccurrenceOutOfOrder
First-occurrence ordering violated (BIP 388 well-formedness).
Fields
MultipathAltCountMismatch
All multipaths in a template must share the same alt-count.
ForbiddenTapTreeLeaf
Tap-script-tree leaf has a tag that is forbidden per spec §6.3.1.
OperatorContextViolation
Operator appears in a forbidden context per SPEC v0.30 §11.
TopLevel is enforced decoder-side at decode_payload; TapLeaf is
covered by the narrower Error::ForbiddenTapTreeLeaf; MultiBody is
structurally unreachable post-v0.30 Phase C (multi-family bodies carry
raw kiw-bit indices, not child tags).
Fields
context: ContextKindWhich tree-position the tag is forbidden in.
ChunkCountOutOfRange
Chunk count out of range. Per SPEC v0.30 §2.5: 1 ≤ count ≤ 64.
ChunkIndexOutOfRange
Chunk index ≥ count; require index < count.
ChunkSetIdOutOfRange
Chunk-set-id exceeds 20-bit range.
ChunkHeaderChunkedFlagMissing
Chunk header missing chunked-flag. Per SPEC v0.30 §2.2: bit 0 of the first 5-bit symbol of a chunked payload is the chunked-flag (followed by the 4-bit version field); it MUST be 1 in every chunk header.
ChunkCountExceedsMax
Encoding requires more chunks than the spec maximum (64).
Codex32DecodeError(String)
Codex32 decode error (HRP mismatch, alphabet violation, BCH verification failure).
Codex32EncodeError(String)
Codex32 encode error (BCH layer failure).
ChunkSetEmpty
Chunk set is empty (no strings provided to reassemble).
ChunkSetInconsistent
Chunks in the set disagree on version, chunk-set-id, or count.
ChunkSetIncomplete
Chunk set incomplete: got fewer chunks than expected.
ChunkIndexGap
Chunk index gap: expected index N, got M.
ChunkSetIdMismatch
Chunk-set-id mismatch between expected and reassembled-then-derived.
VarintOverflow
LP4-ext varint value exceeds single-extension payload range (29 bits).
MissingExplicitOrigin
A non-canonical wrapper has no explicit origin path for some @N,
either via OriginPathOverrides or a populated path_decl entry,
and canonical_origin(&d.tree) is None. Per spec v0.13 §6.3.
InvalidPresenceByte
presence_byte had non-zero reserved bits (bits 2..7) inside a
WalletPolicyId canonical-record preimage. Per spec v0.13 §5.3:
encoders MUST set reserved bits to 0 and decoders MUST reject
inputs with non-zero reserved bits. v0.13’s encoder masks reserved
bits explicitly when building the hash preimage; the helper
crate::identity::validate_presence_byte enforces the
decoder-side contract for canonical-record consumers.
InvalidXpubBytes
A Pubkeys TLV entry’s 33-byte compressed-pubkey field (bytes
32..65 of the 65-byte xpub payload) failed to parse as a valid
secp256k1 point. The 32-byte chain code prefix is unvalidated.
Per spec v0.13 §6.4.
MissingPubkey
Address derivation requires a populated Pubkeys TLV entry for
every @N; this descriptor is missing one (template-only or
partial-keys mode). v0.14+ derivation surface only.
ChainIndexOutOfRange
Descriptor::derive_address was called with a chain index
outside the use-site multipath alt-count (or non-zero when no
multipath is present).
Fields
HardenedPublicDerivation
Address derivation requires non-hardened use-site components, but this descriptor’s use-site path declares a hardened alternative or hardened wildcard. BIP 32 forbids hardened derivation from a public key, so an xpub-only restore cannot produce addresses for this wallet.
AddressDerivationFailed
Address derivation failed at the miniscript layer (or in the
AST → miniscript converter). Carries a free-form detail string
describing the underlying error — typically a miniscript::Error,
a Tr/Wsh constructor failure (type-check / context error), or
an arity/context mismatch raised by the converter.
NUMSSentinelConflict
Inside a tr() body, is_nums = false was paired with a key_index
out of range (key_index >= n). Per SPEC v0.30 §7 + §11: the
placeholder-index range is 0..n strictly; the v0.x NUMS sentinel
slot at key_index = n is gone (NUMS is now flag-driven via
Body::Tr.is_nums). Raised by validate_placeholder_usage when the
in-tr() overflow condition is hit.
DecodeRecursionDepthExceeded
Decode-side recursion depth exceeded the hardening cap.
read_node calls itself recursively for tags with child bodies
(Tag::Sh, Tag::AndV, Tag::TapTree, Tag::Multi, Tag::Tr,
etc.); a hostile wire payload nesting these tags arbitrarily deep
would blow the Rust stack. The cap is shared across all recursive
tags as a generic anti-DOS hardening bound. v0.19 introduced.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()