@solana/kit · General

Solana error #2

INVALID_NONCE

Appears as Solana error #2; Decode this error by running `npx @solana/errors decode -- 2 '…'`

Message

The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`

Placeholders (expectedNonceValue, actualNonceValue) are filled from the error’s context. Paste the base64 argument below to see the real values.

What it means

The durable nonce value in the transaction does not match the current value stored in the nonce account.

What to do

  • Fetch the nonce account right before building and use its current nonce as the lifetime.
  • Ensure no other process advanced the nonce in between.

Decode it locally instead

npx @solana/errors decode -- 2 '<base64 context>'

In development, import from @solana/kit as usual and the full message is thrown. In production the message is stripped to keep bundles small; the error object still carries error.context with the same values this page decodes, and isSolanaError(err, SOLANA_ERROR__INVALID_NONCE) lets you branch on it.

Decode another error

Try: