# AbiError Errors

## `AbiError.SelectorMismatchError`

Thrown when the selector of the provided data does not match the selector of the error, or of one of its overloads.

### Examples

```ts twoslash
// @noErrors
import { AbiError } from 'ox'

const error = AbiError.from(
  'error Unauthorized(address account)'
)

AbiError.decode(
  error,
  '0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004626f6f6d00000000000000000000000000000000000000000000000000000000'
)
// @error: AbiError.SelectorMismatchError: Selector "0x08c379a0" does not match the expected selector "0x8e4a23d6".
// @error: Error: error Unauthorized(address account)
// @error: Selector: 0x8e4a23d6
```

### Solution

Ensure that the data was encoded for the error, or use [`AbiError.extract`](/api/AbiError/extract) to resolve the error from the data.

```ts twoslash
import { AbiError } from 'ox'

const error = AbiError.from(
  'error Unauthorized(address account)'
)

AbiError.decode(
  error,
  '0x8e4a23d6000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045'
)
```

**Source:** [src/core/AbiError.ts](https://github.com/wevm/ox/blob/main/src/core/AbiError.ts#L915)
