in-solana by Supanode

Computational budget exceeded

The transaction consumed more compute units (CUs) than its allocated budget. The default limit is 200,000 CUs per instruction or 1,400,000 CUs per transaction. When the limit is reached, the transaction fails but the base fee is still charged.

Common causes

  1. Complex program logic. Programs with loops, large data processing, or deep call stacks consume more CUs than simple transfers.
  2. Compute unit limit set too low. If you set a custom compute unit limit to save on priority fees, it may be too low for the transaction.
  3. Unexpected program behavior. A program bug or unexpected input can cause excessive computation.

How to fix

  1. Simulate the transaction with simulateTransaction to see the actual CU consumption.
  2. Set the compute unit limit to the simulated amount plus a 10-20% safety margin.
  3. If the program legitimately needs more CUs, increase the limit with the setComputeUnitLimit instruction.
import { getSetComputeUnitLimitInstruction } from "@solana-program/compute-budget";

// After simulating and finding actual usage is 180,000 CUs:
const setLimitIx = getSetComputeUnitLimitInstruction({
  units: 220_000, // 180k + ~20% margin
});

FAQ

Do I still pay the fee if the transaction fails? Yes. The base fee (5,000 lamports) is charged even on failure. The priority fee is charged proportional to CUs consumed up to the failure point.

What is the maximum compute unit limit? 1,400,000 CUs per transaction. A single instruction defaults to 200,000 CUs but can be increased with setComputeUnitLimit.

How do I reduce CU consumption? Optimize your program: avoid unnecessary allocations, reduce loop iterations, minimize cross-program invocations, and use precomputed data where possible.

Error text variants

  • Computational budget exceeded
  • exceeded CUs meter at
  • ComputationalBudgetExceeded

Updated: