#[non_exhaustive]#[repr(i32)]pub enum ErrorCode {
Show 30 variants
ParseError = -32_700,
InvalidRequest = -32_600,
MethodNotFound = -32_601,
InvalidParams = -32_602,
InternalError = -32_603,
ServerError = -32_000,
ContentMissRateLimited = -32_003,
ResourceUnavailable = -32_004,
RootNotAnchored = -32_005,
PeerUnreachable = -32_006,
RangeNotSatisfiable = -32_007,
ContentRedirect = -32_008,
RangeMetadataUnrepresentable = -32_009,
UpstreamError = -32_010,
StageInvalidInput = -32_011,
StageNoFiles = -32_012,
StageOverCap = -32_013,
StageCompileFailed = -32_014,
MetadataTooLarge = -32_015,
PushPendingLimited = -32_016,
ContentMissInconclusive = -32_017,
OnionCircuitUnavailable = -32_020,
PrivacyRequiresLocalNode = -32_021,
OnionHopsOutOfRange = -32_022,
Unauthorized = -32_030,
NotSupported = -32_031,
ControlError = -32_032,
NoIdentity = -32_050,
NoPeerNetwork = -32_051,
SendFailed = -32_052,
}Expand description
A canonical DIG-node RPC error code.
Serializes as a bare integer (via serde_repr), spec-compliant for
error.code. #[non_exhaustive] so adding a code in a minor release is
additive; downstream matches must use _ => ….
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
ParseError = -32_700
Invalid JSON was received by the server.
InvalidRequest = -32_600
The JSON sent is not a valid Request object.
MethodNotFound = -32_601
The method does not exist / is not available.
InvalidParams = -32_602
Invalid method parameter(s).
InternalError = -32_603
The node failed to satisfy a well-formed call (network profile).
ServerError = -32_000
Generic server error (config write failure, file I/O, chain read failure).
ContentMissRateLimited = -32_003
This node does not hold the content, and the requestor has exhausted its miss-lookup budget. Unlike an ordinary content miss (an indistinguishable decoy that is never an error), this is an explicit rate-limit signal: the requestor has spent its budget of miss lookups and should back off rather than keep probing.
Resource not available at the requested root — a genuine infrastructure miss (absent module, bad magic, oversize, a trap, an undecodable envelope). Distinct from a content miss, which is an indistinguishable decoy and is never an error.
RootNotAnchored = -32_005
The requested or served generation is not the store’s current on-chain root. The read path pins to the CHIP-0035 singleton’s on-chain root and fails closed rather than serving an unverified generation.
PeerUnreachable = -32_006
No connection to the named peer could be established — every NAT-traversal strategy failed, or the peer is not on this network.
RangeNotSatisfiable = -32_007
The requested byte range lies outside the resource (offset >= total_length) or is otherwise unsatisfiable.
ContentRedirect = -32_008
This node does not hold the content but located peers that do.
data.redirect names the holders + the redirect budget.
RangeMetadataUnrepresentable = -32_009
dig.fetchRange: the resource’s own range metadata cannot be represented
in a conforming frame at all, so this holder can NEVER serve the range.
A resource whose chunk_lens layout or inclusion_proof exceeds the
per-frame bounds has no conforming first frame, even with a paged prologue.
That is a permanent property of the resource, not a transient condition, so
it needs its own code: a client that could not tell it from an ordinary
transport failure would keep retrying a holder that cannot succeed, and would
retry every other holder of the same resource for the same reason.
UpstreamError = -32_010
An upstream/proxy fetch (e.g. rpc.dig.net) failed. Distinct from the
generic ServerError so a client can tell an
upstream fault from a local one.
StageInvalidInput = -32_011
dig.stage: the input directory is unreadable, or the bounded walk
exceeded its byte / file-count / depth budget.
StageNoFiles = -32_012
dig.stage: the input directory contained no files to compile.
StageOverCap = -32_013
dig.stage: the input exceeds the per-store size cap.
StageCompileFailed = -32_014
dig.stage: compiling the capsule failed (CLVM/IO error).
MetadataTooLarge = -32_015
dig.getMetadata: the capsule’s publisher metadata section is refused
because it renders larger than the bounded response ceiling, or is too
complex (more custom entries than the cap allows).
The section is returned WHOLE — it cannot be paged like content — and its
links/custom fields are publisher-controlled, so an oversized section is
refused with this bounded error rather than returned as one very large
response. A normal store’s metadata is well inside the ceiling.
Declared here because dig-node has emitted it, and docs.dig.net has catalogued it, since before this taxonomy existed.
PushPendingLimited = -32_016
cache.pushCapsule: this window is refused because accepting it would
exceed an in-flight reassembly bound — the per-requestor concurrent-push
cap, the global concurrent-push cap, or the global pending-bytes budget.
Retriable: the budget frees as in-flight pushes complete or an abandoned
partial is reaped. Distinct from
MetadataTooLarge, which is a bound on ONE
response, and from
ContentMissRateLimited, which is a
per-requestor lookup budget rather than a memory bound.
Declared here for the same reason as -32015: it was already released.
ContentMissInconclusive = -32_017
dig.getAvailability: this node could not ESTABLISH that nobody holds the
content. A recursive ask reached a hop that timed out, was unreachable, or
refused in a way that carries no information about the content, so the
subtree behind that hop was never actually consulted.
It is deliberately NOT a miss. A plain miss (available: false with
absence_established
true) is a positive assertion: the responder looked and nobody it can reach
holds this. This code is the absence of that assertion.
A client MUST NOT treat it as absence — give up the search and report not-found — and MUST NOT treat it as holder-fatal. Keep looking, and this holder stays eligible for a later ask.
§Why -32017, after two collisions
RangeMetadataUnrepresentable is
holder-FATAL: that holder can never serve that range, so a client should
never ask it again. This code is the opposite instruction on both axes —
nothing is established and nothing is exhausted. A client that could not tell
them apart would either permanently blacklist a merely-uncertain holder or
keep re-asking one that can never serve.
It was then written as -32015, verified free against THIS crate’s list —
where it was free — while -32015 is dig-node’s released
MetadataTooLarge. -32017 was chosen only
after measuring zero occurrences ecosystem-wide.
A mode:"privacy" read could not be served privately (no circuit could
be built, or one died mid-fetch). The node fails closed rather than
downgrading — a silent downgrade would deanonymize the reader.
PrivacyRequiresLocalNode = -32_021
mode:"privacy" was requested but the caller is not the node’s own
trusted local originator. Privacy requires a local DIG node.
OnionHopsOutOfRange = -32_022
The requested privacy.hops (circuit length) is outside [2, 5].
The control-plane call is not authorized (loopback / token gate failed).
NotSupported = -32_031
The control-plane method is recognized but not supported on this node.
ControlError = -32_032
A control-plane runtime error (pin registry, sync trigger, config write).
NoIdentity = -32_050
A directed send was refused because this node has no persistent identity key, so it cannot seal as sender.
NC-1 requires a directed message be sealed to the recipient BY the sender’s identity; without a persistent key there is no sender to seal as, and the node refuses rather than sending something the recipient cannot attribute.
NoPeerNetwork = -32_051
A directed send was refused because this node has no gossip pool — there is no peer transport to carry the message to the recipient.
SendFailed = -32_052
Sealing or sending the directed message failed.
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub const ALL: &'static [ErrorCode]
pub const ALL: &'static [ErrorCode]
Every code, in wire order. Drives the OpenRPC error catalogue and the exhaustiveness conformance test — a new variant must be added here.
Sourcepub const fn machine_code(self) -> &'static str
pub const fn machine_code(self) -> &'static str
The stable UPPER_SNAKE_CASE machine identifier carried in data.code.
This is the branch key an agent keys on; it never changes once assigned.
Sourcepub const fn default_message(self) -> &'static str
pub const fn default_message(self) -> &'static str
The default human-readable summary for this code (used when a caller does not supply a more specific message).
Sourcepub const fn default_origin(self) -> ErrorOrigin
pub const fn default_origin(self) -> ErrorOrigin
The natural ErrorOrigin for this code (which subsystem the failure
arose in). A caller may override it — a ResourceUnavailable bubbled up
from an upstream proxy can be tagged ErrorOrigin::Upstream.
Sourcepub const fn is_jsonrpc_reserved(self) -> bool
pub const fn is_jsonrpc_reserved(self) -> bool
Whether this variant is in the JSON-RPC-reserved range
(-32768..=-32000).
Trait Implementations§
impl Copy for ErrorCode
Source§impl<'de> Deserialize<'de> for ErrorCode
impl<'de> Deserialize<'de> for ErrorCode
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ErrorCode, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ErrorCode, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for ErrorCode
Source§impl Serialize for ErrorCode
impl Serialize for ErrorCode
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnsafeUnpin for ErrorCode
impl UnwindSafe for ErrorCode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.