InvalidFundingProfitability
Drift V2 · Custom(6040) · 0x1798
custom program error: 0x1798
What it means
AMM funding out of bounds pnl
What to do
The error name is the program's own diagnosis. Paste the failed transaction into TxWhy to see which instruction raised it and with which accounts.
Have the transaction that failed with this?
Paste its signature. TxWhy shows the exact instruction and inner call that raised the error, and rebuilds the transaction when the cause is one it can fix (compute limit, expired blockhash, priority fee, stale swap quote).
Code 6040 means something else in other programs
Custom codes are private to each program. Check which program actually raised it: it is the innermost failed call, not necessarily the program you called.
- CannotClaimSwapFeeHeaven DEX
- WrongProgramJupiter DCA
- PartialPriceMismatchMetaplex Auction House
- IncorrectRemainingAccountsLenMetaplex Candy Machine
- WrongGatingDateMetaplex Fixed Price Sale
- AmountNotPegMeteora AMM
- InvalidPoolCreatorAuthorityMeteora CP AMM (DAMM V2)
- InvalidPositionWidthMeteora DLMM
- MigrationFeeHasBeenWithdrawMeteora Dynamic Bonding Curve
- CommissionAccountIsNoneOKX DEX Aggregation Router V2
- DisabledOraclePegOpenBook V2
- AmountRemainingOverflowOrca Whirlpools