Skip to main content

Errors

The Avana Wallet provider may throw an Error when calling a method. Below is a list of all possible error codes and their descriptions. These error codes follow Ethereum's EIP-1193 and EIP-1474.

In addition to these standardized protocols, Avana wallet adds a data attribute to certain errors (mainly applicable for Code -32003, Transaction rejected) to provide additional context for you. The rationale for this attribute is outlined here, and errors map to the errors included in Solana SDK Transaction Error. We have implemented this design to help you understand why a transaction was rejected.

We recommend calling methods with a try/catch to handle possible errors. The error response will include a code and message.

Standard Error Codes

CodeDescription
4001

User rejected the request

Examples:

- User canceled connect or approval request

- User closed popup window without proceeding

- Eager connect is unsuccesful

4100

Requested method and/or account has not been authorized by the user

Examples:

- Attempted to sign transaction before connecting to wallet

4200

Provider does not support the requested method

Examples:

- Calling a method that does not exist, for example window.solana.someMethodThatDoesNotExist()

4900

Provider is disconnected from all chains

Examples:

- Avana is disconnected from all chains

- Indicates a broader network issue preventing Avana from connecting all chains

4901

Provider is not connected to the requested chain

Examples:

- Avana is disconnected from the specific chain

- Indicates a network RPC issue preventing Avana from connecting to chain

-32000

Missing or invalid parameters

-32002

Requested resource not available

-32003

Transaction rejected

See custom data attribute error codes below to get additional context

-32005

Request exceeds defined limit

-32601

Method does not exist

-32602

Invalid method parameters

-32603

Internal Avana JSON-RPC error

Custom Data Attribute Error Codes

The errors below can be referenced in the Solana SDK Transaction Error docs.

CodeDescription
1000

AccountInUse

1001

AccountLoadedTwice

1002

AccountNotFound

Examples:

- Account has not yet been funded with an initial SOL amount

1003

ProgramAccountNotFound

1004

InsufficientFundsForFee

Examples:

- Fee payer does not have adequate SOL balance to cover transaction fee

1005

InvalidAccountForFee

1006

AlreadyProcessed

Examples:

- Network has already seen and processed this transaction

1007

BlockhashNotFound

Examples:

- Blockhash has expired

- Invalid blockhash

1008

InstructionError

Examples:

- The program instruction threw an error

Debug by reviewing transaction logs and program code

1009

CallChainTooDeep

1010

MissingSignatureForFee

1011

InvalidAccountIndex

1012

SignatureFailure

1013

InvalidProgramForExecution

1014

SanitizeFailure

1015

ClusterMaintenance

1016

AccountBorrowOutstanding

1017

WouldExceedMaxBlockCostLimit

1018

UnsupportedVersion

1019

InvalidWritableAccount

1020

WouldExceedMaxAccountCostLimit

1021

WouldExceedMaxAccountDataCostLimit

1022

TooManyAccountLocks

1023

AddressLookupTableNotFound

1024

InvalidAddressLookupTableOwner

1025

InvalidAddressLookupTableData

1026

InvalidAddressLookupTableIndex

Examples

Catching An Error
try {
await window.solana.connect();
} catch (error) {
// { code: 4001, message: 'User rejected the request' }
}
Failed Transaction As Result Of Expired Blockhash
try {
const transactionThatWillFail = new Transaction();
// ... long wait before submitting transaction

await window.solana.signAndSendTransaction(transactionThatWillFail);
} catch (error) {
// { code: -32003, message: 'Transaction rejected', data: {code: 1007, message: 'BlockhashNotFound'}}
}