Instruction errors (runtime)

AccountBorrowFailed

Appears as instruction tries to borrow reference for an account which is already borrowed

Instruction

AccountBorrowFailed

“instruction tries to borrow reference for an account which is already borrowed”

A program tried to borrow an account's data while it was already borrowed, often during a CPI.

Common causes

  • Holding a RefMut on an account's data while invoking a CPI that uses the same account.

How to fix it

  • Drop borrows (drop(data) or end the scope) before the CPI.

Decode another error

Try: