AURA

Errors

SdkError variants and AURA program error codes for the Rust SDK.

Pre-alpha — not production ready

aura-sdk targets Solana devnet only. APIs may change without notice. Do not use for real funds until a stable release and audit are published.

The Rust SDK uses a single SdkError enum for all errors.

SdkError Enum

use aura_sdk::SdkError;

pub enum SdkError {
    /// Solana RPC returned an error.
    Rpc(solana_client::client_error::ClientError),

    /// The requested account does not exist on-chain.
    AccountNotFound(Pubkey),

    /// Anchor account decoding failed.
    AccountDecode {
        account_name: &'static str,
        message: String,
    },

    /// Converting a treasury record back into the domain model failed.
    DomainDecode(String),

    /// The client was asked to submit a transaction without a configured payer.
    MissingDefaultPayer,

    /// A caller-supplied parameter was invalid before any RPC call was made.
    InvalidParameter(String),
}

Handling Errors

use aura_sdk::{AuraClient, SdkError};

match client.get_treasury(&treasury_pda) {
    Ok(treasury) => println!("Agent: {}", treasury.agent_id),
    Err(SdkError::AccountNotFound(addr)) => {
        println!("No treasury at {}", addr);
    }
    Err(SdkError::AccountDecode { account_name, message }) => {
        eprintln!("Decode failed for {}: {}", account_name, message);
    }
    Err(SdkError::DomainDecode(msg)) => {
        eprintln!("Domain conversion failed: {}", msg);
    }
    Err(SdkError::MissingDefaultPayer) => {
        eprintln!("Create the client with with_payer() to use send_with_default_payer");
    }
    Err(SdkError::InvalidParameter(msg)) => {
        eprintln!("Bad parameter: {}", msg);
    }
    Err(SdkError::Rpc(e)) => {
        eprintln!("RPC error: {}", e);
    }
}

Program Error Codes

The AURA program emits Anchor error codes starting at 6000. These arrive inside SdkError::Rpc(_).

CodeNameDescription
6000UnauthorizedAiCaller is not the registered AI authority
6001UnauthorizedOwnerCaller is not the treasury owner
6002UnauthorizedGuardianCaller is not a registered guardian
6003UnauthorizedExecutorCaller is not an authorized executor
6004PendingTransactionExistsA proposal is already pending; resolve it first
6005NoPendingTransactionNo pending proposal to act on
6006DWalletNotConfiguredNo dWallet registered for the requested chain
6007DWalletAlreadyRegisteredA dWallet is already registered for this chain
6008PolicyGraphMismatchFHE policy graph digest does not match
6009PolicyDigestMismatchPolicy digest mismatch on verification
6010DecryptionNotReadyDecryption result is not yet available
6011MessageApprovalNotReadydWallet message approval is not ready
6012SignatureVerificationFailedSignature verification failed
6013InvalidDeploymentInvalid deployment configuration
6014InvalidExternalAccountDataInvalid external account data
6015ConfidentialGuardrailsNotConfiguredConfidential guardrails must be set up first
6016PolicyOutputNotReadyEncrypted policy output is not ready yet
6017ExecutionPausedTreasury execution is currently paused
6018PendingTransactionExpiredThe pending proposal TTL has elapsed
6019NoActiveOverrideNo active guardian override to act on
6020InvalidChainInvalid chain value
6021InvalidTransactionTypeInvalid transaction type value
6022InvalidCurveInvalid dWallet curve value
6023InvalidSignatureSchemeInvalid signature scheme value
6024InvalidViolationCodeInvalid violation code
6025InvalidProposalStatusInvalid proposal status transition
6026InvalidGuardianConfigurationInvalid guardian configuration
6027TimelockNotElapsedTimelock period has not elapsed
6028SanctionedAddressRecipient address is on the sanctions list
6029RecipientBlacklistedRecipient is on the address deny list
6030RecipientNotWhitelistedRecipient is not on the address allow list
6031CooldownNotElapsedCooldown period between large transactions has not elapsed
6032HighRiskTransactionRequiresGuardianHigh-risk transaction requires guardian co-signature
6033InvalidStateTransitionInvalid agent state transition
6034ParentLimitExceededParent treasury limit would be exceeded
6035AnomalyDetectedAnomaly detected in transaction pattern
6036SessionKeyInactiveSession key has expired or was revoked
6037SessionKeyScopeViolationSession key scope does not permit this proposal
6038AccountStillActiveAccount cannot be closed while still active
6039BudgetEnvelopeLimitExceededBudget envelope limit would be exceeded
6040ApprovalLevelNotSatisfiedApproval ladder level has not been satisfied
6041PendingExecutionTimelockActivePending execution timelock is still active
6042ExecutionScopePausedExecution scope is paused
6043OperatorRoleMissingOperator role is missing required permission
6044OperatorRoleExpiredOperator role has expired or was revoked
6045ExternalDependencyStaleExternal dependency freshness check failed
6046InvalidPolicyPresetPolicy preset kind is invalid
6047PolicyAttestationMismatchPolicy attestation hash or version mismatch
6048EmptyBatchBatch proposal cannot be empty
6049BatchTooLargeBatch proposal exceeds maximum item count
6050ExposureGroupLimitExceededCross-treasury exposure group limit exceeded
6051ExposureGroupUnauthorizedTreasury is not a member of the exposure group

Converting to anyhow

SdkError implements std::error::Error, so it works with anyhow directly:

use anyhow::{Context, Result};
use aura_sdk::AuraClient;

fn fetch_treasury(client: &AuraClient, pda: &Pubkey) -> Result<AgentTreasury> {
    client
        .get_treasury(pda)
        .with_context(|| format!("failed to fetch treasury {}", pda))
}

On this page