On-Chain Reference
Error Codes

Error Codes

All custom errors are defined in the SandboxError enum. Anchor prepends a 6000 offset — so error index 0 = code 6000 in the runtime.

CodeNameCauseResolution
6000AlreadyStakedstake_nft called but a StakeAccount already exists for this mint + ownerUnstake first, or you are already staking this NFT
6001NotStakedunstake_nft or claim_rewards called but no StakeAccount foundThe NFT is not staked — nothing to unstake or claim
6002NotOwnerSigner does not match stake_account.owner or agent_account.ownerSign with the wallet that originally staked / deployed
6003NothingToClaimclaim_rewards called but elapsed time < 1 second, yielding 0 rewardsWait at least 1 day for meaningful rewards to accrue
6004NotCollectionMemberNFT's Metaplex metadata does not reference the Sandbox GHI verified collectionYou are attempting to stake a non-Sandbox GHI NFT
6005InvalidTierNFT metadata contains an unrecognized tier attribute valueMetadata corruption — contact support with the NFT mint address
6006AgentAlreadyDeployeddeploy_agent called but AgentAccount already exists for this mint + ownerClose the existing agent first with close_agent
6007AgentNotStakeddeploy_agent called but NFT is not stakedStake the NFT before deploying an agent
6008InsufficientBudgetghi_budget arg in deploy_agent is below the minimum (1 $GHI)Provide at least 1_000_000 raw units (1 $GHI)
6009BudgetExhaustedAgent's ghi_budget reached 0 — submit_task_result cannot debitTop up or close the agent
6010AgentInactivesubmit_task_result called but agent_account.is_active == falseAgent is paused or closed — re-deploy to activate
6011UnauthorizedExecutorsubmit_task_result signed by non-authority keyThis instruction is reserved for the off-chain executor
6012VaultInsufficientGHI vault balance too low to pay rewardsProtocol-level issue — report on Discord
6013MathOverflowReward calculation overflowed u64Should not occur under normal operation — report if seen

Reading Errors Client-Side

With @coral-xyz/anchor, errors surface as AnchorError objects:

try {
  await program.methods.stakeNft().accounts({...}).rpc();
} catch (err) {
  if (err instanceof AnchorError) {
    console.log(err.error.errorCode.code);   // e.g. "AlreadyStaked"
    console.log(err.error.errorCode.number); // e.g. 6000
    console.log(err.error.errorMessage);
  }
}