# AbiFunction Errors

## `AbiFunction.SelectorMismatchError`

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

### Examples

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

const transfer = AbiFunction.from(
  'function transfer(address to, uint256 amount)'
)

AbiFunction.decodeData(
  transfer,
  '0x095ea7b3000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa960450000000000000000000000000000000000000000000000000000000000000001'
)
// @error: AbiFunction.SelectorMismatchError: Selector "0x095ea7b3" does not match the expected selector "0xa9059cbb".
// @error: Function: function transfer(address to, uint256 amount)
// @error: Selector: 0xa9059cbb
```

### Solution

Ensure that the data was encoded for the function.

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

const transfer = AbiFunction.from(
  'function transfer(address to, uint256 amount)'
)

AbiFunction.decodeData(
  transfer,
  '0xa9059cbb000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa960450000000000000000000000000000000000000000000000000000000000000001'
)
```

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