associated_token
account init depends on order of accounts in context, gives terrible error message
#2463
Labels
associated_token
account init depends on order of accounts in context, gives terrible error message
#2463
Problem
If an
associated_token
account withinit
is present in a context before an uninitialized mint withinit
flag is listed, then Anchor can't initialize the Associated Token Account and fails upon the call to the TokenProgram with "incorrect program id
".Steps to reproduce:
Call an instruction with this context and you'll get
SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: incorrect program id for instruction
.Still happening in 0.27.0.
Easy workaround is, just swap the order of
mint
andprogram_ata
in the context. But I lost hours debugging a large program for this reason.Proposed solutions
init
uses a Mint withinit
that is listed laterThe text was updated successfully, but these errors were encountered: