Skip to main content

ErrorCode

Enum ErrorCode 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

§

ResourceUnavailable = -32_004

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.

§

OnionCircuitUnavailable = -32_020

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].

§

Unauthorized = -32_030

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

Source

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.

Source

pub const fn code(self) -> i32

The raw integer wire code.

Source

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.

Source

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).

Source

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.

Source

pub const fn is_jsonrpc_reserved(self) -> bool

Whether this variant is in the JSON-RPC-reserved range (-32768..=-32000).

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for ErrorCode

Source§

impl Debug for ErrorCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ErrorCode

Source§

fn deserialize<D>( deserializer: D, ) -> Result<ErrorCode, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for ErrorCode

Source§

impl Hash for ErrorCode

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ErrorCode

Source§

fn eq(&self, other: &ErrorCode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for ErrorCode

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for ErrorCode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more