Bundler Error Codes
If a UserOperation is valid, the bundler return the calculated userOpHash for it. In case of failure, the bundler return an error result object, with code and message.
Here are the common error codes as defined by the protocol. These error codes supplement the standard JSON-RPC error codes that are typically returned in response to an incorrect method call.
Additionally, many of these errors will be accompanied by an extra error message provided by the Entrypoint.
Invalid UserOp Error Codes
| Code | Description |
|---|---|
| -32500 | Transaction rejected by entryPoint’s simulateValidation, during wallet creation or validation. The message field is set the FailedOp’s “AAxx” error message from the EntryPoint. |
| -32501 | Transaction rejected by paymaster’s validatePaymasterUserOp |
| -32502 | Transaction rejected because of opcode validation |
| -32503 | UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon) |
| -32504 | Transaction rejected because paymaster (or signature aggregator) is throttled or banned |
| -32505 | Transaction rejected because paymaster (or signature aggregator) stake or unstake-delay is too low |
| -32506 | Transaction rejected because wallet specified unsupported signature aggregator |
| -32507 | Transaction rejected because of wallet signature check failed (or paymaster signature, if the paymaster uses its data as signature) |
| -32508 | Transaction rejected because paymaster balance cannot cover all pending UserOperations |
| -32521 | Transaction was reverted during the execution phase |
| -32602 | Invalid UserOperation struct/fields |
Standard JSON-RPC Error Codes
| Code | Description |
|---|---|
| -32700 | Parse error: the request body is not valid JSON |
| -32600 | Invalid request, or the method is not supported by this endpoint |
| -32601 | Method not found |
| -32602 | Invalid params, including an invalid UserOperation struct or fields |
| -32603 | Internal error. Retry the request, and contact us if it persists |
Handling Bundler Errors in AbstractionKit
AbstractionKit throws bundler failures as an AbstractionKitError with code: "BUNDLER_ERROR". The numeric code is on errno, and cause is a nested AbstractionKitError whose code names the specific error:
| Bundler code | error.cause.code |
|---|---|
| -32500 | SIMULATE_VALIDATION |
| -32501 | SIMULATE_PAYMASTER_VALIDATION |
| -32502 | OPCODE_VALIDATION |
| -32503 | EXPIRE_SHORTLY |
| -32504 | REPUTATION |
| -32505 | INSUFFICIENT_STAKE |
| -32506 | UNSUPPORTED_SIGNATURE_AGGREGATOR |
| -32507 | INVALID_SIGNATURE |
| -32508 | PAYMASTER_DEPOSIT_TOO_LOW |
| -32521 | EXECUTION_REVERTED |
| -32602 | INVALID_FIELDS |
| -32601 | METHOD_NOT_FOUND |
| -32603 | INTERNAL_ERROR |
| Any other | UNKNOWN_ERROR |
When the message carries an EntryPoint revert code, it is also exposed on error.aaCode (for example "AA21").
The JSON-RPC error the bundler returned is one level further down, on error.cause.cause. Its code is the numeric bundler code, and its data holds the error's data field when the bundler sends one.
The paymaster clients report a paymaster rejection during gas estimation as PAYMASTER_ERROR instead, with the bundler error as its cause. See paymaster error handling.
import { AbstractionKitError } from "abstractionkit";
try {
await bundler.sendUserOperation(userOperation, entrypointAddress);
} catch (error) {
if (error instanceof AbstractionKitError && error.code === "BUNDLER_ERROR") {
const cause = error.cause as AbstractionKitError | undefined;
if (cause?.code === "PAYMASTER_DEPOSIT_TOO_LOW") {
// retry later or contact the paymaster provider
}
}
}