Issue Overview
I’m getting a serialization error when trying to create NFTs with my Candy Machine v3 setup. The minting process fails with a BorshIoError that shows ‘Unknown variant index: 1’ in the transaction logs.
Error Details
Transaction failed: SendTransactionError occurred during simulation.
Error: Failed to process Instruction 2 - serialization issue with account data.
Program Logs:
[
"Program log: Instruction: MintV2",
"Program 11111111111111111111111111111111 invoke [2]",
"Program 11111111111111111111111111111111 success",
"Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR invoke [2]",
"Program log: Instruction: MintV2",
"Program log: Error occurred - BorshIoError with message: Unknown variant index: 1. Error Code: 64424509440",
"Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR used 35507 compute units of 748405",
"Program CndyV3LdqHUfDLmE5naZjVN8rBZz4tqhdefbAnjHG3JR failed: serialization error",
"Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g used 86802 compute units of 799700",
"Program Guard1JwRhJkVH6XZhzoYxeBVQe872VH6QggF4BWmS9g failed: account data error"
]
Setup Code
Machine Creation
const client = createUmi(
PROJECT_CONFIG.SOLANA_RPC || 'https://api.devnet.solana.com'
)
.use(mplCandyMachine())
.use(mplTokenMetadata());
const WALLET_FILE = path.join(__dirname, 'creator-wallet.json');
const walletData = new Uint8Array(
JSON.parse(fs.readFileSync(WALLET_FILE, 'utf-8'))
);
const creatorKeypair = client.eddsa.createKeypairFromSecretKey(walletData);
const walletSigner = createSignerFromKeypair(client, creatorKeypair);
client.use(keypairIdentity(walletSigner));
console.log('Creator wallet:', walletSigner.publicKey.toString());
const seriesMint = generateSigner(client);
const seriesAuthority = walletSigner;
await createNft(client, {
mint: seriesMint,
authority: client.identity,
name: "test-collection-name",
uri: "collection-metadata-url",
sellerFeeBasisPoints: percentAmount(3, 2),
isCollection: true,
}).sendAndConfirm(client);
const machineKeypair = generateSigner(client);
const createTx = await create(client, {
candyMachine: machineKeypair,
collectionMint: seriesMint.publicKey,
collectionUpdateAuthority: client.identity,
tokenStandard: TokenStandard.NonFungible,
sellerFeeBasisPoints: percentAmount(3, 2),
itemsAvailable: BigInt(1000),
creators: [
{
address: publicKey(PAYMENT_WALLET),
verified: true,
percentageShare: 100
}
],
configLineSettings: some({
prefixName: "",
nameLength: 32,
prefixUri: "",
uriLength: 200,
isSequential: true
}),
guards: {
startDate: some({
date: dateTime("2025-01-15T00:00:00.000Z")
}),
endDate: some({
date: dateTime("2025-03-15T00:00:00.000Z")
}),
solPayment: some({
lamports: sol(0.5),
destination: publicKey(PAYMENT_WALLET),
})
}
});
Minting Service
async createToken(machineAddress: string) {
try {
const machine = await fetchCandyMachine(
this.client,
publicKey(machineAddress)
);
const tokenMint = generateSigner(this.client);
const transaction = await transactionBuilder()
.add(setComputeUnitLimit(this.client, { units: 900_000 }))
.add(
mintV2(this.client, {
candyMachine: machine.publicKey,
nftMint: tokenMint,
collectionMint: machine.collectionMint,
collectionUpdateAuthority: machine.authority,
mintArgs: {
solPayment: some({
destination: publicKey(PAYMENT_WALLET)
}),
}
})
);
return await transaction.sendAndConfirm(this.client);
} catch (err) {
console.error('Token creation failed:', err);
throw err;
}
}
Package Versions
{
"dependencies": {
"@metaplex-foundation/mpl-candy-machine": "^6.1.0",
"@metaplex-foundation/mpl-token-metadata": "^3.4.0",
"@metaplex-foundation/umi": "^1.0.0",
"@metaplex-foundation/umi-bundle-defaults": "^1.0.0"
}
}
Testing Environment
- Solana Devnet
- Candy Machine v3
- Current UMI versions
What I Need Help With
This serialization error is blocking my NFT creation process. I’ve verified that all metadata was uploaded correctly and the machine deployment worked fine. The error seems to happen during the actual minting step. Has anyone encountered this specific BorshIoError before? What could cause this variant index issue during NFT minting?