> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://v3.viem.sh/api/mcp` to find what you need.

# AbiError.getSelector

:::info
`AbiError.getSelector` is a re-export of ox's [`AbiError.getSelector`](https://oxlib.sh/api/AbiError/getSelector). Refer to the ox documentation for the full reference.
:::

Computes the [4-byte selector](https://solidity-by-example.org/function-selector/) for an [`AbiError.AbiError`](/docs/utilities/abierror/types#abierror).

## Imports

```ts
import { AbiError } from 'viem/utils'
```

## Examples

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

const selector = AbiError.getSelector(
  'error BadSignatureV(uint8 v)'
)
// @log: '0x6352211e'
```

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

const selector = AbiError.getSelector({
  inputs: [{ name: 'v', type: 'uint8' }],
  name: 'BadSignatureV',
  type: 'error'
})
// @log: '0x6352211e'
```

## Definition

```ts
function getSelector(
  abiItem: string | AbiError,
): Hex.Hex
```

## Parameters

### abiItem

* **Type:** `string | AbiError`

The ABI item to compute the selector for.

#### abiItem.hash

* **Type:** `0x${string}`
* **Optional**

#### abiItem.overloads

* **Type:** `readonly any[]`
* **Optional**

## Return Type

The first 4 bytes of the [`Hash.keccak256`](/docs/utilities/hash/keccak256) hash of the error signature.

`Hex.Hex`
