Skip to main content
A solanaInstructionDecoder was built with a discriminator set it can’t use: an instruction with no discriminator or with more than one, discriminators of mixed widths across the decoder (d1/d2/d4/d8), or two instructions sharing a discriminator. A decoder covers a single program/ABI — one width, distinct discriminators — because Anchor discriminators are program-independent, so a shared one would decode the same raw instruction under both keys. Fix — give each instruction exactly one discriminator, keep a single width per decoder, and split unrelated programs into separate solanaInstructionDecoder() calls. If the mixed widths really do belong to one program — an ABI whose extension instructions carry a wider discriminator than its base ones — split it by width instead: one decoder per width, the same programId. Wrong — two different programs in one decoder. Their swap instructions are unrelated, but Anchor derives both discriminators from sha256("global:swap"), so they collide and each would decode the other’s data:
Right — one decoder per program/ABI:
Also right — one ABI covering several addresses. This is the legitimate array case: the instruction has the same discriminator, arguments and account layout at every address, so one definition decodes it across all of them. Token and Token-2022 are distinct programs, but Token-2022 implements Token’s instruction set — transfer is identical on both:

Related topics

Error reference