Program failed to complete
The program consumed all its allocated compute units before finishing execution.
Common causes
- Not enough compute units requested. The default is 200,000 CUs per instruction. Complex operations like multiple CPI calls, large data processing, or heavy math can exceed this.
- Infinite or very long loop. A loop in the program runs too many iterations.
- Large account deserialization. Deserializing many accounts or large data structures costs significant compute.
How to fix
- Request more compute units. Add a
SetComputeUnitLimitinstruction from the Compute Budget Program before your program instruction:
import { ComputeBudgetProgram } from "@solana/web3.js";
const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
units: 400_000,
});
- Optimize the program. Reduce unnecessary computation, minimize CPI calls, and avoid large loops.
- Split into multiple transactions. If the work cannot fit in one transaction, break it into smaller steps.
Compute unit costs
| Operation | Approximate CU cost |
|---|---|
| Basic instruction | 200 |
| SHA256 hash | 100 per 32 bytes |
| CPI call | 1,000 base + invoked program CUs |
| Account creation | 2,500 |
| Log message | 100 per log |
The maximum compute budget per transaction is 1,400,000 CUs.
FAQ
What is the default compute unit limit? 200,000 CUs per instruction, with a maximum of 1,400,000 CUs per transaction.
Do compute units affect transaction fees?
Yes. When you set a compute unit price via SetComputeUnitPrice, the priority fee is calculated as computeUnits × microLamportsPerCU. Requesting more CUs increases the maximum possible fee, but you only pay for CUs actually consumed.
How do I check how many CUs my transaction uses?
Use simulateTransaction — the response includes unitsConsumed.
Error text variants
-
Program failed to complete -
exceeded CUs meter at BPF instruction -
ComputationalBudgetExceeded
Updated: