# Errors

In Pali, there exist distinct error messages that might appear should a problem arise. To elucidate this, we will display these particular errors and clarify the circumstances under which they might occur.

# "Method only available for..."

Pali is a multichain wallet, and for this functionality, certain methods are exclusively accessible for UTXO-based chains or EVM-based chains. Therefore, it's critical to understand that if you attempt to connect Pali to a UTXO-based dApp while the current network is EVM-based, you will encounter this error message.

Here are the different variations of this error that you might encounter, also the code error for this message always will be 4101:

"Method only available when connected on EVM chains"

or

"Method only available for syscoin UTXO chains"

As a workaround, you can handle this error with the sys_changeUTXOEVM/eth_changeUTXOEVM methods. These are useful for switching between a UTXO-based network and an EVM-based network, and vice versa. Each method receives the chain ID of your preferred network as a parameter. See the following code snippet for how to use it:

// Use this if you are connected to a UTXO-based network and you want to switch to an EVM-based network
window.ethereum.request({
  method: "eth_changeUTXOEVM",
  params: [{ chainId: 57 }],
});

// Use this if you are connected to an EVM-based network and you want to switch to a UTXO-based network
window.pali.request({
  method: "sys_changeUTXOEVM",
  params: [{ chainId: 57 }],
});

# EVM-only errors

In some cases, when you are connected to an EVM-based network, you may receive some standard errors under specific circumstances.

Here is a JSON with error codes as keys and standards/messages as values:

{
  "-32700": {
    "standard": "JSON RPC 2.0",
    "message": "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
  },
  "-32600": {
    "standard": "JSON RPC 2.0",
    "message": "The JSON sent is not a valid Request object."
  },
  "-32601": {
    "standard": "JSON RPC 2.0",
    "message": "The method does not exist / is not available."
  },
  "-32602": {
    "standard": "JSON RPC 2.0",
    "message": "Invalid method parameter(s)."
  },
  "-32603": {
    "standard": "JSON RPC 2.0",
    "message": "Internal JSON-RPC error. Verify if chain ID is already added, if is not try adding the chain first."
  },
  "-32000": {
    "standard": "EIP-1474",
    "message": "Invalid input."
  },
  "-32001": {
    "standard": "EIP-1474",
    "message": "Resource not found."
  },
  "-32002": {
    "standard": "EIP-1474",
    "message": "Resource unavailable."
  },
  "-32003": {
    "standard": "EIP-1474",
    "message": "Transaction rejected."
  },
  "-32004": {
    "standard": "EIP-1474",
    "message": "Method not supported."
  },
  "-32005": {
    "standard": "EIP-1474",
    "message": "Request limit exceeded."
  },
  "4001": {
    "standard": "EIP-1193",
    "message": "User rejected the request."
  },
  "4100": {
    "standard": "EIP-1193",
    "message": "The requested account and/or method has not been authorized by the user."
  },
  "4101": {
    "message": "Connected to Ethereum based chain"
  },
  "4200": {
    "standard": "EIP-1193",
    "message": "The requested method is not supported by this Ethereum provider."
  },
  "4900": {
    "standard": "EIP-1193",
    "message": "The provider is disconnected from all chains."
  },
  "4901": {
    "standard": "EIP-1193",
    "message": "The provider is disconnected from the specified chain."
  }
}