10

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

Normalbut_Genuine
  • 511
  • 2
  • 5
  • 13

2 Answers2

13

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.

Jon C
  • 7,019
  • 10
  • 17
  • 3
    What do I do if the sending token account actually does have enough funds? – Ozymandias Oct 21 '21 at 06:35
  • 1
    I got the same issue. I have enough fund but having that error. Anyone knows why? – Danny Nov 25 '21 at 18:26
  • 4
    it only contain 19 error, i got `custom program error: 0x26` where do i see error explanation for `26`? – kafinsalim Jan 04 '22 at 06:57
  • @kafinsalim check [my answer](https://stackoverflow.com/a/71450262/423171) for error 0x26 and any other error that you cannot find in the link provided in this answer. – cprcrack Mar 12 '22 at 14:01
4

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.

cprcrack
  • 17,118
  • 7
  • 88
  • 91
  • 1
    what if the error I'm getting is 2003 (0x7d3) [SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 2: custom program error: 0x7d3 ] – BennoDev May 24 '22 at 15:40
  • 1
    If the error code is below 20, how do you know which error file to look in? – Alaska Jun 23 '22 at 14:47