Solana Error: Instruction 4 Failed - Account is Frozen
Learn why the "Instruction 4 Failed - Account is Frozen" error occurs on Solana and how to resolve it. Understand the causes, such as frozen token accounts, compliance rules, and program restrictions.
Introduction
When interacting with Solana programs or SPL tokens, you may encounter the error:
Program error: Instruction 4 Failed - account is frozen
This issue prevents transactions, staking, or transfers involving a specific token account. Understanding why this happens and how to resolve it is essential for developers and users.
1. What Causes the "Account is Frozen" Error?
1.1 Token Account is Frozen by the Token Program
Some SPL tokens have freeze authority, allowing issuers to freeze accounts for regulatory compliance or security reasons. When frozen, an account cannot send or receive tokens.
1.2 Compliance and Blacklist Rules
Certain projects implement blacklists for compliance reasons, freezing accounts flagged for suspicious activity or regulatory restrictions.
1.3 Program-Specific Restrictions
Some smart contracts enforce restrictions that prevent frozen accounts from participating in transactions. This is common in DeFi platforms requiring KYC verification.
2. How to Check if an Account is Frozen?
To determine if an SPL token account is frozen, use the Solana CLI:
solana account <TOKEN_ACCOUNT_ADDRESS>
Alternatively, check with Solana Web3.js:
const { Connection, PublicKey } = require("@solana/web3.js");
const { getAccount } = require("@solana/spl-token");
const connection = new Connection("https://api.mainnet-beta.solana.com");
const tokenAccount = new PublicKey("TOKEN_ACCOUNT_ADDRESS");
async function checkFrozenStatus() {
const accountInfo = await getAccount(connection, tokenAccount);
console.log(`Is Frozen: ${accountInfo.isFrozen}`);
}
checkFrozenStatus();
If isFrozen
is true
, the account is currently restricted from transactions.
3. How to Unfreeze an Account?
3.1 Request Unfreeze from Token Issuer
- If the token has a freeze authority, contact the token issuer for unfreezing.
- Some issuers have specific compliance steps before unfreezing accounts.
3.2 Use the Freeze Authority (If You Own It)
If you control the freeze authority, use the Solana CLI to unfreeze the account:
spl-token thaw <TOKEN_ACCOUNT_ADDRESS> <TOKEN_MINT_ADDRESS>
Or with Web3.js:
const { thawAccount } = require("@solana/spl-token");
await thawAccount(connection, freezeAuthority, tokenAccount, tokenMint);
3.3 Create a New Token Account
If the account remains frozen and cannot be unfrozen, creating a new SPL token account and transferring funds may be an alternative solution.
4. Preventing Account Freezing Issues
- Check token terms before transacting with SPL tokens that have freeze mechanisms.
- Avoid flagged addresses in compliance-restricted environments.
- Use verified contracts to ensure the program doesn't impose unexpected restrictions.
Conclusion
The "Instruction 4 Failed - Account is Frozen" error occurs when an SPL token account is frozen due to compliance rules, issuer settings, or program restrictions. Identifying the reason and contacting the freeze authority or using the correct CLI/Web3.js commands can help resolve the issue.
Stay informed and ensure your transactions comply with token issuer policies to prevent disruptions in your Solana interactions.