library / How to use Solana / HS0012
Transaction version error -32015
One TypeScript file reproduces -32015 on a recent transaction, then fetches the same signature with maxSupportedTransactionVersion set to 1 and prints its version. It only reads: no key pair and no signing.
Why the error appears
Solana transactions come in versions. A legacy transaction lists every account it touches inside the message, 32 bytes each. A version 0 transaction can point at address lookup tables instead: the message carries a one-byte index into a table, and the node resolves the full key when it runs the transaction. That lets one transaction touch more accounts inside the same 1,232-byte packet limit. Mainnet also carries version 1 transactions.
A method that returns a transaction or a block has to decide what to do with a version the caller never mentioned. A call that leaves out maxSupportedTransactionVersion accepts legacy transactions only, and a value of 0 adds version 0. When the transaction has a version the call does not accept, the call fails with code -32015. The message begins Transaction version (1) or Transaction version (0), matching the transaction, and names the value to set.
Nothing is wrong with the transaction. The same signature is served as soon as the request says which versions it can read. That is why the error shows up in code that worked for years: the address it follows starts receiving version 0 or version 1 transactions, and the first one stops the loop.
The code
Install @solana/kit at 8.6.0, export CARBIUM_KEY and run the file with Node 24, which strips TypeScript types on its own. The one argument is an address whose recent transactions include newer versions, such as a busy program that routes through lookup tables. The file lists ten recent signatures, fetches each one without the option until a call fails with -32015, then fetches that same signature with maxSupportedTransactionVersion: 1 and prints what came back.
// HS0012 · Transaction version error -32015// https://carbium.sh/library/howsolana/transaction-version-error-32015// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { setTimeout as sleep } from "node:timers/promises";import { address, createDefaultRpcTransport, createSolanaRpcFromTransport, isSolanaError, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,} from "@solana/kit";const key = process.env.CARBIUM_KEY;if (!key) { console.error("Set CARBIUM_KEY to your Carbium API key."); process.exit(1);}const url = process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh";const rpc = createSolanaRpcFromTransport( createDefaultRpcTransport({ url, headers: { "x-api-key": key } }),);const [addr] = process.argv.slice(2);if (!addr) { console.error("Usage: node main.ts <address that sees many transactions>"); process.exit(1);}// Wait out one 429 using its retry-after hint, then try once more.async function retry429<T>(run: () => Promise<T>): Promise<T> { try { return await run(); } catch (e) { if (!isSolanaError(e, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR) || e.context.statusCode !== 429) throw e; const seconds = Number(e.context.headers.get("retry-after")) || 1; console.error(`429: waiting ${seconds}s, then one more try`); await sleep(seconds * 1000); return run(); }}const isUnsupportedVersion = (e: unknown) => isSolanaError(e, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION);const sigs = await retry429(() => rpc.getSignaturesForAddress(address(addr), { limit: 10 }).send(),);let reproduced = false;for (const { signature } of sigs) { try { await retry429(() => rpc.getTransaction(signature).send()); console.log(`${signature}: served without the option (a legacy transaction)`); } catch (e) { if (!isUnsupportedVersion(e)) throw e; console.log(`${signature}: error -32015 without maxSupportedTransactionVersion`); const tx = await retry429(() => rpc.getTransaction(signature, { encoding: "json", maxSupportedTransactionVersion: 1 }).send(), ); const version = tx && "version" in tx ? tx.version : undefined; console.log(`${signature}: served with the option, version ${String(version)}, slot ${tx?.slot}`); reproduced = true; break; }}if (!reproduced) console.log("No transaction in the last 10 signatures needed the option; try a busier address.");
run: node main.ts <address-that-sees-many-transactions>
retry429 retries a rate-limited call once, and the rpc object is built once and reused. isSolanaError with SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION matches the numeric code -32015, so the check never depends on the wording of the message. The fix is one config object, { maxSupportedTransactionVersion: 1, encoding: "json" }, as the second argument of getTransaction. The types in @solana/kit ask for encoding whenever the version option is set, and json is the shape the server returns by default.
Reading the answer
| Call | Transaction | Answer |
|---|---|---|
| No option | Legacy | Served. |
| No option | Version 0 or 1 | Error -32015. |
| maxSupportedTransactionVersion: 0 | Legacy | Served, version reads "legacy". |
| maxSupportedTransactionVersion: 0 | Version 0 | Served, version reads 0. |
| maxSupportedTransactionVersion: 0 | Version 1 | Error -32015. |
| maxSupportedTransactionVersion: 1 | Version 1 | Served, version reads 1. |
A version 0 message lists only its static account keys in transaction.message.accountKeys. Accounts that came from a lookup table appear in meta.loadedAddresses, as a writable list and a readonly list. The full ordered account list is the static keys, then the loaded writable keys, then the loaded readonly keys, and every instruction's account indexes point into that combined list. Reading the indexes against the static keys alone attributes instructions to the wrong accounts. With jsonParsed encoding the node returns the combined list, and each key carries a source of transaction or lookupTable.
Where else to set it
- getBlock takes the same option. With transactionDetails set to full (the default) or accounts, a block holds many transactions, and one transaction with a version the call does not accept fails the whole call. With the option absent, a version 0 or a version 1 transaction fails the block; at 0, only version 1 does. The signatures and none settings return no transaction bodies and skip the version check.
- The jsonParsed, base64 and base58 encodings need it too. The encoding changes the shape of the answer and leaves the version rule alone.
- A raw JSON-RPC body carries it in the last positional parameter: [signature, {"maxSupportedTransactionVersion": 1}].
- A batch needs the option in every entry, because each entry is judged on its own.
- Client libraries expose the same name in their config object. An old release may predate it or may not accept the value 1, so upgrade the library when the name or the value is refused.
On Carbium
Every call in the file goes to https://services.carbium.sh, the RPC endpoint.
getTransaction and getSignaturesForAddress each cost 50 cells. For a version 1 transaction with the option absent or 0, Carbium answers -32015 uncharged, so the retry is the call that pays its 50 cells, and it is still a second round trip. Set the option on the first call. A loop that learns the lesson signature by signature sends every newer transaction twice. The rate limit for getSignaturesForAddress is 0.24 requests per second on Free, 1.2 on Dev, 100 on Business and 500 on Pro.
To read many transactions in one round trip, post a JSON-RPC batch of up to 100 calls with the option in each entry. @solana/kit has no batch call, so that is a raw fetch POST of a JSON array to the same URL with the same header.
Where it ends
The option names the highest version you will accept, and it teaches your decoder nothing. A value of 1 covers legacy, version 0 and version 1. A transaction of a higher version still raises the same error, with that version in the message. Raise the value after the code that reads the transaction handles the new format, and read what came back before you parse a version you have not seen.
A null result is a different answer. getTransaction returns null when no transaction with that signature exists at the commitment you asked for, for example a signature sent a moment ago that has not reached confirmed. That is not -32015, and the option does not change it.
Retrying the same request returns -32015 again, so change the request.
Signature listing reaches back 30 days at most, so getSignaturesForAddress cannot hand this file an older address history. An empty page past that point means the index's age limit was reached, and it says nothing about the address's first transaction.
The file reads and prints a version. It does not decode instructions or sign anything.
When it goes wrong
| what goes wrong | what to do |
|---|---|
| Error -32015 with Transaction version (0) or Transaction version (1) in the message, on getTransaction or getBlock. | Add { maxSupportedTransactionVersion: 1 } to the config object of that call. With @solana/kit the object also needs an encoding, such as json. Nothing else about the request has to change. |
| getTransaction works now but getBlock still returns -32015. | getBlock has its own config object. Set the option there too, and on every other call that returns transaction bodies. |
| -32015 again after you set the option to 0, with version 1 in the message. | Mainnet carries version 1 transactions, and a value of 0 refuses them. Set the value to 1. Update the code that reads transactions before you raise it past the version it handles. |
| null for a signature you just sent. | That is a different problem from the version rule. The transaction has not reached the commitment you asked for, or the signature is wrong. Wait a moment and ask again, then check the signature. |
| A version 0 transaction shows the wrong accounts after the error is gone. | You read instruction indexes against accountKeys alone. Append meta.loadedAddresses.writable and then readonly, or ask for jsonParsed encoding. |
Questions
Why did code that worked yesterday start failing?
The address you follow began to receive version 0 or version 1 transactions, and your call never said it could read them.
What value should I pass?
Pass 1. It accepts legacy, version 0 and version 1 transactions, and mainnet carries all three. Use a higher number once your decoder handles that version.
Can I catch the error and retry with the option?
You can, and the file does it to show the error. It sends every newer transaction twice, so set the option on the first call.
Does a signature listing hit this error?
No. getSignaturesForAddress returns signatures with slot and error fields and no transaction bodies, so it has no version to refuse.