Reference
Contracts
Error Codes

Error Codes

All error codes for the Balancer V2 core contracts are defined in the BalancerErrors.sol (opens in a new tab) contract. Comments and context for the specific errors can be found in the tables below.

Math

CodeErrorComment
000ADD_OVERFLOW
001SUB_OVERFLOW
002SUB_UNDERFLOW
003MUL_OVERFLOW
004ZERO_DIVISION
005DIV_INTERNALMultiplication overflow during FixedPoint Division
006X_OUT_OF_BOUNDSInvalid x in ExpMath.pow(x, y)
007Y_OUT_OF_BOUNDSInvalid y in ExpMath.pow(x, y)
008PRODUCT_OUT_OF_BOUNDSIn LogExpMath.pow(x, y), error computing x^y as exp(y * ln(x))
009INVALID_EXPONENTIn LogExpMath.exp(x) = e^x; x out of bounds

Input

CodeErrorComment
100OUT_OF_BOUNDS
101UNSORTED_ARRAYSee UNSORTED_TOKENS
102UNSORTED_TOKENSTokens must be sorted in address order on pool registration
103INPUT_LENGTH_MISMATCHUsed to ensure array inputs intended to be parallel have the same length
104ZERO_TOKENAddress to be interpreted as a token cannot be 0
105INSUFFICIENT_DATAUsed to ensure minimum bytes length

Shared pools

CodeErrorComment
200MIN_TOKENSAll pools must contain at least two tokens
201MAX_TOKENSToken count exceeds the maximum for a given pool type
202MAX_SWAP_FEE_PERCENTAGE
203MIN_SWAP_FEE_PERCENTAGE
204MINIMUM_BPTOn pool initialization, a small amount of BPT is minted to the zero address (keeps math well behaved). If initial balances are too small, initialization can fail
205CALLER_NOT_VAULTCertain pool callbacks need to be external, but could be exploited if called by anyone but the Vault
206UNINITIALIZEDPools must be initialized with a special "Init" join, before they can be joined by LPs
207BPT_IN_MAX_AMOUNTSlippage/front-running protection check failed on a pool exit
208BPT_OUT_MIN_AMOUNTSlippage/front-running protection check failed on a pool join
209EXPIRED_PERMIT
210NOT_TWO_TOKENSPools with oracles are limited to two tokens (e.g., WeightedPool2Tokens and MetastablePools). A pool with the TWO_TOKEN specialization must have exactly two tokens
211DISABLEDPool factories can be disabled to prevent new pools being created

Pools

CodeErrorComment
300MIN_AMPAmplification factor out of range (Stable/Metastable pools)
301MAX_AMP
302MIN_WEIGHTWeighted Pool minimum weight
303MAX_STABLE_TOKENS
304MAX_IN_RATIOToken in unbalanced the pool too much on a swap
305MAX_OUT_RATIOToken out unbalanced the pool too much on a swap
306MIN_BPT_IN_FOR_TOKEN_OUTDisproportionate exit unbalanced the pool too much
307MAX_OUT_BPT_FOR_TOKEN_INDisproportionate join unbalanced the pool too much
308NORMALIZED_WEIGHT_INVARIANTWeighted Pool normalized weights must add to 1.0
309INVALID_TOKEN
310UNHANDLED_JOIN_KINDSome joins are pool type-specific
311ZERO_INVARIANTPool balances must be > 0
312ORACLE_INVALID_SECONDS_QUERYThe "ago" timestamp when querying the oracle must be in the past
313ORACLE_NOT_INITIALIZEDCannot query an oracle with no data
314ORACLE_QUERY_TOO_OLDCannot query before the oracle's earliest data sample
315ORACLE_INVALID_INDEXCannot query a sample outside the buffer (1024)
316ORACLE_BAD_SECSOracle query window must have non-zero duration
317AMP_END_TIME_TOO_CLOSEAmplification parameter change has less than the minimum duration
318AMP_ONGOING_UPDATECannot start an amplification parameter update if one is already ongoing
319AMP_RATE_TOO_HIGHThe requested amplification parameter change is too fast (cannot halve or double over less than a day)
320AMP_NO_ONGOING_UPDATECannot cancel an update if there isn't one
321STABLE_INVARIANT_DIDNT_CONVERGE
322STABLE_GET_BALANCE_DIDNT_CONVERGE
323RELAYER_NOT_CONTRACT
324BASE_POOL_RELAYER_NOT_CALLED
325REBALANCING_RELAYER_REENTERED
326GRADUAL_UPDATE_TIME_TRAVELstart > end time in a gradual weights update
327SWAPS_DISABLED
328CALLER_IS_NOT_LBP_OWNER
329PRICE_RATE_OVERFLOWRate returned from a rateProvider must fit in 128 bits
330INVALID_JOIN_EXIT_KIND_WHILE_SWAPS_DISABLEDInvestment pools only allow proportional joins and exits when swaps are disabled (to prevent unbalancing the pool)
331WEIGHT_CHANGE_TOO_FASTGradual weight update duration too short (minimum 1 day)
332LOWER_GREATER_THAN_UPPER_TARGETInvalid Linear Pool operating range
333UPPER_TARGET_TOO_HIGHLinear Pool max balance must fit in 112 bits
334UNHANDLED_BY_LINEAR_POOLSome joins/exits are pool type-specific
335OUT_OF_TARGET_RANGECannot reset Linear Pool targets if pool is unbalanced
336UNHANDLED_EXIT_KINDSome exits are pool type-specific
337UNAUTHORIZED_EXITManagement fees can only be collected by the pool owner
338MAX_MANAGEMENT_SWAP_FEE_PERCENTAGE
339UNHANDLED_BY_MANAGED_POOLSome joins/exits are pool type-specific
340UNHANDLED_BY_PHANTOM_POOLSome joins/exits are pool type-specific
341TOKEN_DOES_NOT_HAVE_RATE_PROVIDER
342INVALID_INITIALIZATION
343OUT_OF_NEW_TARGET_RANGE
344FEATURE_DISABLED
345UNINITIALIZED_POOL_CONTROLLER
346SET_SWAP_FEE_DURING_FEE_CHANGE
347SET_SWAP_FEE_PENDING_FEE_CHANGE
348CHANGE_TOKENS_DURING_WEIGHT_CHANGE
349CHANGE_TOKENS_PENDING_WEIGHT_CHANGE
350MAX_WEIGHT
351UNAUTHORIZED_JOIN
352MAX_MANAGEMENT_AUM_FEE_PERCENTAGE
353FRACTIONAL_TARGET
354ADD_OR_REMOVE_BPT
355INVALID_CIRCUIT_BREAKER_BOUNDS
356CIRCUIT_BREAKER_TRIPPED
357MALICIOUS_QUERY_REVERT
358JOINS_EXITS_DISABLED

Lib

CodeErrorComment
400REENTRANCY
401SENDER_NOT_ALLOWED
402PAUSED
403PAUSE_WINDOW_EXPIRED
404MAX_PAUSE_WINDOW_DURATION
405MAX_BUFFER_PERIOD_DURATION
406INSUFFICIENT_BALANCE
407INSUFFICIENT_ALLOWANCE
408ERC20_TRANSFER_FROM_ZERO_ADDRESS
409ERC20_TRANSFER_TO_ZERO_ADDRESS
410ERC20_MINT_TO_ZERO_ADDRESS
411ERC20_BURN_FROM_ZERO_ADDRESS
412ERC20_APPROVE_FROM_ZERO_ADDRESS
413ERC20_APPROVE_TO_ZERO_ADDRESS
414ERC20_TRANSFER_EXCEEDS_ALLOWANCE
415ERC20_DECREASED_ALLOWANCE_BELOW_ZERO
416ERC20_TRANSFER_EXCEEDS_BALANCE
417ERC20_BURN_EXCEEDS_ALLOWANCE
418SAFE_ERC20_CALL_FAILED
419ADDRESS_INSUFFICIENT_BALANCE
420ADDRESS_CANNOT_SEND_VALUE
421SAFE_CAST_VALUE_CANT_FIT_INT256
422GRANT_SENDER_NOT_ADMINIn AccessControl, the caller of grantRole must be an admin
423REVOKE_SENDER_NOT_ADMINIn AccessControl, the caller of revokeRole must be an admin
424RENOUNCE_SENDER_NOT_ALLOWEDIn AccessControl, callers can onlyrenounceRole for their own account
425BUFFER_PERIOD_EXPIRED
426CALLER_IS_NOT_OWNER
427NEW_OWNER_IS_ZERO
428CODE_DEPLOYMENT_FAILED
429CALL_TO_NON_CONTRACT
430LOW_LEVEL_CALL_FAILED
431NOT_PAUSED
432ADDRESS_ALREADY_ALLOWLISTED
433ADDRESS_NOT_ALLOWLISTED
434ERC20_BURN_EXCEEDS_BALANCE
435INVALID_OPERATION
436CODEC_OVERFLOW
437IN_RECOVERY_MODE
438NOT_IN_RECOVERY_MODE
439INDUCED_FAILURE
440EXPIRED_SIGNATURE
441MALFORMED_SIGNATURE
442SAFE_CAST_VALUE_CANT_FIT_UINT64
443UNHANDLED_FEE_TYPE
444BURN_FROM_ZERO

Vault

CodeErrorComment
500INVALID_POOL_ID
501CALLER_NOT_POOLSome Vault hooks can only be called by the pool (e.g., register tokens)
502SENDER_NOT_ASSET_MANAGER
503USER_DOESNT_ALLOW_RELAYERRelayers must be allowed by both governance and the user account
504INVALID_SIGNATURE
505EXIT_BELOW_MINExit would yield fewer than the user-supplied minimum tokens out
506JOIN_ABOVE_MAXJoin would cost more than the user-supplied maximum tokens in
507SWAP_LIMITSwap violates user-supplied limits (min out or max in)
508SWAP_DEADLINESwap transaction not mined within the specified deadline
509CANNOT_SWAP_SAME_TOKEN
510UNKNOWN_AMOUNT_IN_FIRST_SWAPA batch swap must start with a non-zero amount in
511MALCONSTRUCTED_MULTIHOP_SWAP
512INTERNAL_BALANCE_OVERFLOWUnused in current code
513INSUFFICIENT_INTERNAL_BALANCE
514INVALID_ETH_INTERNAL_BALANCECannot transfer native ETH to/from internal balance
515INVALID_POST_LOAN_BALANCEFlashloan transactions must repay the loan in the same transaction
516INSUFFICIENT_ETH
517UNALLOCATED_ETHUnused in current code
518ETH_TRANSFERRelayers cannot receive ETH directly (only through the Vault)
519CANNOT_USE_ETH_SENTINELInternal Balance transfers cannot use ETH
520TOKENS_MISMATCH
521TOKEN_NOT_REGISTERED
522TOKEN_ALREADY_REGISTERED
523TOKENS_ALREADY_SET
524TOKENS_LENGTH_MUST_BE_2
525NONZERO_TOKEN_BALANCE
526BALANCE_TOTAL_OVERFLOW
527POOL_NO_TOKENS
528INSUFFICIENT_FLASH_LOAN_BALANCE

Fees

CodeErrorComment
600SWAP_FEE_PERCENTAGE_TOO_HIGH
601FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH
602INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT

FeeSplitter

CodeErrorComment
700SPLITTER_FEE_PERCENTAGE_TOO_HIGH

Misc

CodeErrorComment
998UNIMPLEMENTED
999SHOULD_NOT_HAPPEN

© 2023 Balancer Labs