'I want to know causing a solana transfer error
My token sending program has met an issue about sending transaction, throwing an error below.
Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1
It is related with sol balance. I want to know what is causing this problem. Is it because there is less sol on the sending side? Or I wonder if it's because the recipient has less sol
Solution 1:[1]
The error for the token program is defined here: https://github.com/solana-labs/solana-program-library/blob/ea354ab358021aa08f774e2d4028b33ec56d4180/token/program/src/error.rs#L16
0x1
= InsufficientFunds
, so in this case means that the sending token account does not have enough funds to send to the recipient.
Solution 2:[2]
This kind of errors are usually listed in error definition files in the public Github repository of the Solana Programs that generate them. If you can't find the error in the Solana Program Library Token program errors, you may be getting an error from the Metaplex Program Library's Token Metadata program, which is also extensively used by different Solana ecosystem tools such as Metaboss.
Remember that you will first need to convert the hex value (that's what the 0x prefix signald). For example, to find Error processing Instruction 4: custom program error: 0x26
, I first converted 0x26 to decimal, which is 38, and I then used Chrome's search functionality to find the 39th appearance of the text error(
, which resulted in this line:
#[error("If using a creators array, you must be one of the creators listed")]
MustBeOneOfCreators,
Now at least you have a more descriptive error to work with.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jon C |
Solution 2 | cprcrack |