Skip to main content
The App Kit SDK surfaces failures as KitError instances with a BorrowError code. Errors fall into two Borrow categories:
  • Input errors (codes 1200-1299) signal that the request is invalid, stale, or references state that doesn’t exist. Fix the request and retry.
  • Service errors (codes 8200-8299) signal a backend or provider failure. Most are transient and safe to retry. A few are fatal, so check the table row before retrying.

Handling errors

The thrown KitError.name is prefixed with BORROW_ (for example, BORROW_LOAN_NOT_FOUND for the LOAN_NOT_FOUND code in the input errors table). Match on error.code, not on the raw name. Use the isInputError and isRetryableError helpers to branch:
TypeScript

Input errors

Service errors

Other errors

Some Borrow failures surface with codes outside the BorrowError range:

Retry a failed operation

kit.borrow.borrow, kit.borrow.repay, kit.borrow.addCollateral, kit.borrow.withdrawCollateralRepayIfNeeded, and kit.borrow.closeLoan run through several phases before they confirm onchain, and kit.borrow.retry(error) resumes a failed operation from where it stopped. When the Circle-signed execution has not expired, retry submits it again instead of requesting a new one. An operation that already confirmed is refused, so a retry cannot accidentally open a second loan or pay a repayment twice.
TypeScript
SIGNED_BUNDLE_EXPIRED (1213) is marked retryable, but kit.borrow.retry resubmits the same signed execution and fails again. Handle it by calling the original operation with a new idempotencyKey instead. To deduplicate submissions across process boundaries, see Use idempotency keys.