failed: custom program error: 0x7d0'

pub fn bid(ctx: Context<Bid>, price: u64) -> Result<()> {
    let auction = &ctx.accounts.auction;

    let bidder = &mut ctx.accounts.bidder;

    // Check bidder's balance against auction's price.
    if price < auction.price {
        return Err(error!(MarketError::InsufficientMoney));

    if (Clock::get()?.unix_timestamp as u128) > auction.end_time {
        return Err(error!(MarketError::AuctionEnded));

    //if refund_receiver exist return the money
    if auction.refund_receiver != Pubkey::default() {

        **ctx.accounts.auction.to_account_info().try_borrow_mut_lamports()?  -= auction.price;
        **ctx.accounts.refund_receiver.try_borrow_mut_lamports()? += auction.price;


    // Transfer bid price to auction  account


    //update the auction info

    let auction = &mut ctx.accounts.auction;
    auction.refund_receiver = ctx.accounts.bidder.key();
    auction.price = price;  



this is my function..

pub struct Bid<'info> {
        seeds = [
        has_one = creator
    pub auction: Account<'info, Auction>,

    /// CHECK: This account's address is only used.
    pub mint_key: AccountInfo<'info>,

    /// CHECK: This account's address is only used.
    pub creator: AccountInfo<'info>,

    pub bidder: Signer<'info>,

    /// CHECK: This account's address is only used.
    pub refund_receiver: AccountInfo<'info>,

    pub system_program: Program<'info, System>,
    pub token_program: Program<'info, Token>,
    pub associated_token_program: Program<'info, AssociatedToken>,

this is the context i am providing.

await program.methods.bid(
      new BN(price)
      auction: auctionAccount,
      mintKey: mintKey,
      creator: ownerKey,
      bidder: bidder.key.publicKey,
      refundReceiver: auction.refundReceiver,

and this is how i am calling the program.. I am unable to figure out where the code is going wrong..!!!?? if there is a better way to do it plss suggest...

  • Can you try setting at the beggining of your instruction the auction account to mut? let auction = &ctx.accounts.auction; -> let auction = &mut ctx.accounts.auction; Commented Sep 14, 2022 at 14:07
  • Hi @Lobo1897 did you fix this issue?
    – marethyu
    Commented Jan 27, 2023 at 2:52
  • Yeah issue of IDL mismatch.. delete the target folder and build the again
    – Lobo1897
    Commented Feb 8, 2023 at 15:46

3 Answers 3


Just ran into the same error. The issue (in my case) was my IDL was out-of-sync with the program I invoking on dev-net. The program was expecting a mutable account but the IDL had the account marked as immutable. The up-to-date IDL was still sitting in my target folder generated by anchor & I had not copied it to my JS build. Hope this helps.

  • Okay. May be the problem in generated Idl. I got this error while running "anchor test". So the IDL was fetched by target folder.
    – Lobo1897
    Commented Oct 4, 2022 at 2:55

The only inconsistency I see is that at the beginning you initialize an auction variable without &mut while your account is well mut (while bidder you initialize it well with &mut) and further down, you re-initialize the auction variable with &mut


Adding my answer here for anyone who finds themselves in a similar situation with a different solution - In my case, the account I was passing to the function was a non-existant account (it existed on mainnet but not devnet) and resulted in this error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.