During an on-chain execution of a contract call, the following errors should be expected to be thrown from Pro contracts.

Code Description
1001 The package being used is not supported. This can happen when a new package upgrade has been published and the protocol has been updated to only recognize the new package. Any one using the older packages will run into this error code.
1002 The coin provided as input to the deposit call does not have enough amount. The user provides the input coin and the amount to be deposited into the external asset bank. So if the coin has X balance and the user wants to deposit Y amount where Y > X the contract will revert with this error
1003 The nonce generated by external bank deposit passed as input to deposit to internal bank call either does not exist ( never was generated by the external bank) or has already been consumed/processed by the internal bank - This can happen when the chain event listener picks up the same deposit event twice and sends the same external deposit twice to the off-chain margining engine.
1004 When the address provided as input for any contract call is zero address
1005 Triggered when the sequence hash computed on-chain differs from the sequence hash off-chain expects to be computed. The sequence hash allows us to ensure that on-chain and off-chain are executing the transactions in the same order
1006 When a user signs a payload off-chain for any request, the id the of the Internal Data Store is part of the payload. This id is unique for each environment (staging, testnet or mainnet) which allows on-chain to ensure that a payload signed for testnet can not be executed on mainnet or vice versa. The error code 1006 is thrown when chain receives a different ids id in the payload from the one provided as input to contract call
1007 Triggered when the maintenance margin being set for the perpetual is invalid. Error code 1030 is also emitted for the same purpose. The later code is more generic and is used for other purposes as well
1008 Triggered when the input value provided is zero for any contract call
1009 Triggered when the perpetual/market symbol provided as part of any payload does not exist or is not supported by the chain
1010 The admin of the protocol can make changes to any perpetual config like step size, tick size etc.. directly on-chain. And these changes are done on the external data store (EDS) that are later propagated to IDS via off-chain margining engine. The chain restricts updation of multiple values/config of a perpetual/market at the same time. Admin must first make a change and have that change reflected on the IDS before they can make another change to perpetual config on EDS - This error code is thrown when there is an already existing pending sync on EDS
1011 Emitted when on-chain receives a request for execution from a sequencer that has already been executed. This is basically a transaction replay error code.
1012 Emitted when the account being deleveraged ( maker of the ADL call) is not bankrupt
1014 Triggered when the signer of a payload request does not have permission to execute/perform that action such as fee operator trying to set funding rate or a non-authorized account trying to trade on behalf of some account
1015 The id of the EDS is part of the withdrawal payload that user signs. It is the only payload that has the EDS id, all others specify the IDS id. This is similar to error code 1006
1016 This is triggered when the account being fetched from the IDS does not exist
1017 This is triggered when an account does not have enough margin
1018 Triggered when the admin of the protocol tries to create another perpetual/market with the same symbol. Two markets can not have the same symbol
1019 This is triggered when the oracle price being passed as input to contract call does not conform to min/max oracle price allowed for that perpetual or the tick size.
1020 Triggered when trying to synchronize perpetual between EDS and IDS that is already up to date i.e. nothing is there to sync.
1021 Triggered when the maker/taker orders of the trade do no belong to same market
1022 Triggered when the leverage provided for an order/liquidation is incorrect. For cross-orders, the leverage should be zero. For isolated orders or liquidation, the leverage should match the existing open position leverage
1023 Triggered when trying to trade, liquidate, adl, adjust leverage or margin on a delisted perpetual
1024 Triggered when trying to trade, liquidate, adl, adjust leverage or margin on a perpetual on which trading is paused
1025 Triggered when the maker/taker orders of a trade belong to same side/direction or the maker/taker positions in ADL have the same direction
1026 Triggered when the price at which a trade is being executed is not valid for the maker or taker of the trade
1027 Triggered when a payload or order received by chain for any contract call execution is expired
1028 Triggered when an order is being overfilled
1029 Triggered when the price at which the trade is being executed is not with in min/max trade price bound or doesn’t conform to tick size
1030 Triggered when the quantity of the trade/liquidation or the values being set on perpetual by the admin are invalid
1031 Triggered when the market take bound is breached during trade
1032 Triggered when trying to sync operators or perpetual between EDS and IDS when there is nothing to sync
1034 Triggered when trying to assume a cross position on a market that only supports isolated
1035 Triggered when trying to access a position that doesn't exist like adjusting margin/leverage of a non-existing isolated position
1036 Triggered when trying to deposit a non-existent or supported asset by the bank
1037 Triggered when admin tries to set an operator that is not supported by the protocol
1038 Triggered when Admin tries to set the same/existing account as the new account for an operator role
1039 Triggered when funding is being set for an invalid time ( not on the hour or mark or in the past)
1040 Triggered when trying to set a funding rate that exceeds the allowed funding percentage
1041 Triggered when trying to support an asset that is already supported by the protocol. The symbol of the asset is used as the unique identifier so if USDT is already supported, admin can not create a new asset with the same symbol
1042 Triggered when trying to liquidate a non-liquidate able account during liquidation trade call
1043 Triggered when all or nothing flag is passed as true by the liquidator and the liquidatee does not have enough position size to satisfy the constraint
1044 Triggered when the guardian tries to prune the invalid or not allowed table to prune. Only order hash and tx replay tables are allowed to be pruned.
1045 Triggered when trying to prune a hash entry that doesn’t exist
1046 Triggered when a payload is created for a lifespan > max allowed lifespan ( difference of expiry and created at is the lifespan of a payload)
1047 Triggered when the asset type T and the symbol of the asset provided as input to contract call do not match with the asset details on the IDS during deposit/withdraw calls
1048 Triggered when margining engine does not get all the required params
1049 Triggered when trying to perform out of order liquidations i.e. the most positive Pnl position is not being liquidated first
1050 Triggered when an unauthorized liquidator tries to perform liquidations
1051 Triggered when the taker/liquidator or the taker of the ADL trade is under water
1052 Triggered when ADLing position size > the position size of the maker or taker
1053 Triggered when the position of the taker in ADL trade does not have positive Pnl
1054 Triggered when admin tries to update an invalid perpetual field
1055 Triggered when trying to delist an already delisted perpetual or trying to set oracle/mark price for a delisted perpetual
1056 Triggered when trying to close position on a. perpetual/market that is not delisted
1057 Triggered when there exists no Max Allowed OI Open set for the leverage being used by the position
4002 Case 2 of health check fails: Account value - Initial Margin Required is < 0 so only actions allowed are reduce position size and add margin
4003 Case 3 of health check fails: If Account value - Maintenance Margin required <= 0, only Liquidation/ADL trades are permissible or adding margin
4004 Case 4 of health check fails: If account value < 0, only margin deposit or liquidation/adl is allowed
2000 The BCS encoded payload is not of the expected format
2001 Triggered when a payload contains an unsupported data type
2002 Triggered when a payload is signed by an unsupported wallet scheme
2003 Triggered when a signature is invalid
2004 When an unknown payload is sent for signature verification