This is a short guide for debugging the custom program errors that come up when interacting with your anchor program using the javascript client library.
100
and 300
, the error is coming from anchor. You can determine the error by looking at the anchor source code.{anchor_workspace}/target/idl
directory) contains your program's errors and corresponding numeric codes.Transaction simulation failed: Error processing Instruction 1: custom program error: 0xa3
Program 11111111111111111111111111111111 invoke [1]
Program 11111111111111111111111111111111 success
Program 8ssSFKfX285ynByKAQNMSUHMGbDzQjV9JTz37MRgnBwh invoke [1]
Program log: Custom program error: 0xa3
Program 8ssSFKfX285ynByKAQNMSUHMGbDzQjV9JTz37MRgnBwh consumed 4295 of 200000 compute units
Program 8ssSFKfX285ynByKAQNMSUHMGbDzQjV9JTz37MRgnBwh failed: custom program error: 0xa3
Translating error Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 1: custom program error: 0xa
0xa3
0xa3
to 163AccountDidNotDeserialize
error and continue debugging from there (in this case my solana program cli library has a stale idl
)Transaction simulation failed: Error processing Instruction 0: custom program error: 0x133
Program Bxvjc7hGds9PajMiX8TCsyGnwWqP49qCYJDSQ3VonFeE invoke [1]
Program log: Custom program error: 0x133
Program Bxvjc7hGds9PajMiX8TCsyGnwWqP49qCYJDSQ3VonFeE consumed 26278 of 200000 compute units
Program Bxvjc7hGds9PajMiX8TCsyGnwWqP49qCYJDSQ3VonFeE failed: custom program error: 0x133
0x133
0x133
to 307"errors": [
{
"code": 300,
"name": "InvalidAMMAuthority",
"msg": "Clearing house not AMM authority"
},
...
{
"code": 307,
"name": "InsufficientCollateral",
"msg": "Insufficient collateral"
},
...
],
InsufficientCollateral
and continue debugging.