Errors
When making requests to Phantom in Establishing a Connection, Sending a Transaction, or Signing a Message, Phantom may respond with an error. Here are the error codes and their meanings. These are inspired the corresponding by EIP-1474 and EIP-1193 on Ethereum.
Code
Title
Description
4001
User Rejected Request
User rejected the request through Phantom.
4100
Unauthorized
The requested method and/or account has not been authorized by the user.
-32603
Internal Error
Something went wrong within Phantom.
-32000
Invalid Input
Missing or invalid parameters.
-32601
Method Not Found
Phantom does not recognize the method.
Typically, these errors will be easily parseable and have both a code and an explanation. For example:
1
try {
2
await window.solana.signMessage();
3
} catch (err) {
4
// {code: 4100, message: 'The requested method and/or account has not been authorized by the user.'}
5
}
Copied!
Last modified 9d ago
Copy link