> **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.extract

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

Extracts an [`AbiError.AbiError`](/docs/utilities/abierror/types#abierror) from an [`Abi.Abi`](/docs/utilities/abi/types#abi) and decodes its arguments from error data.

## Imports

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

## Examples

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

const abi = Abi.from([
  'error InvalidSignature(uint r, uint s, uint8 yParity)'
])

const { error, args } = AbiError.extract(
  abi,
  '0xecde634900000000000000000000000000000000000000000000000000000000000001a400000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001'
)
// @log: {
// @log:   error: { name: 'InvalidSignature', type: 'error', ... },
// @log:   args: [420n, 69n, 1],
// @log: }
```

## Definition

```ts
function extract<abi, as>(
  abi: abi | Abi.Abi | readonly unknown[],
  data: Hex.Hex,
  options?: extract.Options<as>,
): extract.ReturnType<extract.ExtractError<abi>, as>
```

## Parameters

### abi

* **Type:** `abi | Abi.Abi | readonly unknown[]`

The ABI to extract from.

### data

* **Type:** `Hex.Hex`

The error data.

### options

* **Type:** `extract.Options<as>`
* **Optional**

Extraction options.

## Return Type

The extracted ABI Error and decoded arguments.

`extract.ReturnType<extract.ExtractError<abi>, as>`
