OpenAgentID documentation
Source referencesRust module referenceoas-resolve

oas-resolve · error

Declared module signatures, types, configuration, and source documentation.

Source: oas/oas/oas-resolve/src/error.rs. SHA-256: 178fa1d8a81c986f7ff475bcbd5bce7e750260bb1bd2a0c8ccdcd8a366491e40.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

error::ResolveError

Errors that can occur during DID resolution.

Each variant corresponds to a structured error code from OAS Specification §12.5.

Examples

use oas_resolve::error::ResolveError;

let err = ResolveError::NotFound {
    did: "did:oas:test:agent:missing".to_string(),
};
assert_eq!(err.error_code(), "notFound");
#[derive(Debug, Error)]
pub enum ResolveError {
    /// DID not found in any consulted registry.
    ///
    /// Error code: `notFound`
    #[error("DID not found: '{did}'")]
    NotFound {
        /// The DID that was not found.
        did: String,
    },

    /// Document signature does not verify.
    ///
    /// Error code: `invalidSignature`
    #[error("document signature invalid for '{did}': {reason}")]
    InvalidSignature {
        /// The DID of the document with the invalid signature.
        did: String,
        /// Details about the signature failure.
        reason: String,
    },

    /// The DID has been revoked.
    ///
    /// Error code: `revoked`
    #[error("DID has been revoked: '{did}'")]
    Revoked {
        /// The revoked DID.
        did: String,
    },

    /// Lineage chain verification failed.
    ///
    /// Error code: `lineageInvalid`
    #[error("lineage verification failed for '{did}': {reason}")]
    LineageInvalid {
        /// The DID whose lineage is invalid.
        did: String,
        /// Details about the lineage failure.
        reason: String,
    },

    /// Lineage chain could not be fully verified (timeout, missing ancestor).
    ///
    /// Error code: `lineageUnverifiable`
    #[error("lineage unverifiable for '{did}': {reason}")]
    LineageUnverifiable {
        /// The DID whose lineage could not be verified.
        did: String,
        /// Details about why verification failed.
        reason: String,
    },

    /// The human root in the lineage chain is revoked.
    ///
    /// Error code: `humanRootRevoked`
    #[error("human root revoked for lineage of '{did}': root DID '{root_did}'")]
    HumanRootRevoked {
        /// The DID of the entity whose root is revoked.
        did: String,
        /// The revoked human root DID.
        root_did: String,
    },

    /// Human root's liveness attestation has expired.
    ///
    /// Error code: `humanRootLivenessExpired`
    #[error("human root liveness expired for '{did}': root DID '{root_did}'")]
    HumanRootLivenessExpired {
        /// The DID of the entity whose root liveness expired.
        did: String,
        /// The human root DID with expired liveness.
        root_did: String,
    },

    /// Conflicting documents found across registries.
    ///
    /// Error code: `conflictDetected`
    #[error("conflicting documents detected for '{did}': {reason}")]
    ConflictDetected {
        /// The DID with conflicting documents.
        did: String,
        /// Details about the conflict.
        reason: String,
    },

    /// Entity's generation exceeds resolver's MAX_GENERATION.
    ///
    /// Error code: `maxGenerationExceeded`
    #[error("max generation exceeded for '{did}': generation {generation} exceeds limit {max_generation}")]
    MaxGenerationExceeded {
        /// The DID of the entity exceeding the limit.
        did: String,
        /// The entity's generation.
        generation: u32,
        /// The resolver's maximum generation.
        max_generation: u32,
    },

    /// A network or I/O error occurred during resolution.
    #[error("resolution I/O error for '{did}': {reason}")]
    IoError {
        /// The DID being resolved.
        did: String,
        /// Details of the I/O failure.
        reason: String,
    },

    /// An internal resolver error.
    #[error("internal resolver error: {reason}")]
    Internal {
        /// Details of the internal error.
        reason: String,
    },

    /// The terminal root (HMR / MHR / ENR) is not anchored on the
    /// Global Anchor Layer (Sigil), or the anchor record is in a
    /// non-active state, or its anchor block lies in the future.
    ///
    /// Error code: `notAnchored`
    #[error("root not anchored on Sigil for '{did}': {reason}")]
    NotAnchored {
        /// The DID whose root could not be verified against the GAL.
        did: String,
        /// Details about why the GAL anchor was rejected.
        reason: String,
    },

    /// The BLAKE3 commitment recorded by the on-chain anchor does not
    /// match the canonical hash of the resolved DID document. The
    /// document is considered tampered and is rejected.
    ///
    /// Error code: `metadataMismatch`
    #[error("metadata commitment mismatch for '{did}': {reason}")]
    MetadataMismatch {
        /// The DID whose document failed the commitment check.
        did: String,
        /// Details about the mismatch (expected vs actual).
        reason: String,
    },

    /// A non-root entity (kind not in {`hmr`, `mhr`, `enr`}) presented
    /// no lineage section. Required for L1+ documents.
    ///
    /// Error code: `missingLineage`
    #[error("missing lineage section for non-root '{did}'")]
    MissingLineage {
        /// The DID whose lineage section was missing.
        did: String,
    },

    /// The lineage anchor backend was unreachable while resolving. The
    /// resolver fails closed: an unreachable anchor means revocation
    /// state cannot be confirmed and the resolution MUST be rejected.
    ///
    /// Error code: `galUnreachable` - retained for wire compatibility
    /// with consumers that already match on it (the backend this variant
    /// first described was Sigil's GAL). An `anchorUnreachable` alias may
    /// replace it at the next major version.
    #[error("lineage anchor unreachable for '{did}': {reason}")]
    AnchorUnreachable {
        /// The DID being resolved.
        did: String,
        /// Details of the anchor transport / RPC failure.
        reason: String,
    },

    /// An expected on-chain org lineage Merkle inclusion proof was
    /// missing or did not verify.
    ///
    /// Error code: `orgInclusionMissing`
    #[error("org Merkle inclusion missing or invalid for '{did}': {reason}")]
    OrgInclusionMissing {
        /// The DID whose org inclusion check failed.
        did: String,
        /// Details about the failure.
        reason: String,
    },

    /// A non-root entity has a `lineage` section but no
    /// `derivation_proof`. Required for L1+ resolution.
    ///
    /// Error code: `missingLineageProof`
    #[error("missing AgentLineageProof2025 derivation proof for '{did}'")]
    MissingLineageProof {
        /// The DID whose proof is missing.
        did: String,
    },

    /// A legacy lineage proof omits mandatory signed security bindings.
    ///
    /// Error code: `legacyInsecureProof`
    #[error("legacy lineage proof is non-authorizing for '{did}': {reason}")]
    LegacyInsecureProof {
        /// The child DID whose proof is non-authorizing.
        did: String,
        /// The missing or insecure binding.
        reason: String,
    },

    /// The parent's `AgentLineageProof2025` signature does not verify
    /// against the parent DID document's declared key. The child
    /// document is considered untrustworthy and is rejected.
    ///
    /// Error code: `parentSignatureInvalid`
    #[error("parent signature invalid for '{did}': {reason}")]
    ParentSignatureInvalid {
        /// The child DID whose lineage proof failed verification.
        did: String,
        /// Details about the signature failure.
        reason: String,
    },

    /// The parent public key referenced by the lineage proof is not
    /// present in the parent DID document's `verificationMethod` list.
    /// The proof would otherwise sign correctly, but the key is
    /// orphaned — not bound to the parent's declared identity.
    ///
    /// Error code: `parentKeyNotInDocument`
    #[error("proof key not declared by parent '{parent_did}' for child '{did}'")]
    ParentKeyNotInDocument {
        /// The child DID.
        did: String,
        /// The parent DID whose document was inspected.
        parent_did: String,
    },
}

Source line: 25.

error::ResolveError::error_code

Returns the OAS Spec §12.5 error code string for this error.

Examples

use oas_resolve::error::ResolveError;

let err = ResolveError::Revoked { did: "did:oas:test:hmr:alice".to_string() };
assert_eq!(err.error_code(), "revoked");
pub fn error_code(&self) -> &'static str;

Source line: 263.

On this page