'custom program error: 0xbbf on anchor framework solana

const connection = new anchor.web3.Connection("https://api.devnet.solana.com");
    const provider = new anchor.Provider(connection, wallet, {
        preflightCommitment: "recent",
    });
    const programid = new anchor.web3.PublicKey("EcgzWq52GhdCRJFEXub5LCgdqPs5Eid2XfiZSXM22eQu");
    const res = await axios.get(process.env.REACT_APP_API_ENDPOINT+"/stakeidl");
    const idl = await res.data;
    const program = new anchor.Program(idl, programid, provider);
    console.log(program);
    const [collections,bump] = (await PublicKey.findProgramAddress(["collections"],programid));
    console.log(collections,bump);
    const tx = await program.rpc.setAdmin(bump,{accounts:
        {collections:collections,
        admin:wallet.publicKey,
        systemProgram:anchor.web3.SystemProgram.programId}});

Above code is throwing custom program error 0xbbf I create program using publickey and idl and call setAdmin on rust it is giving 0xbbf



Solution 1:[1]

The 0xbbf is the hex representation for 3007. You can see a description of all errors here, for example. https://solanacookbook.com/references/anchor.html#error-codes

I guess in this case, some of the seeds for a PDA don't match up with the right owner, or maybe deployed by a wrong program.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DaveTheAl