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

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

Parses an arbitrary **JSON ABI Error** or **Human Readable ABI Error** into a typed [`AbiError.AbiError`](/docs/utilities/abierror/types#abierror).

## Imports

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

## Examples

### JSON ABIs

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

const badSignatureVError = AbiError.from({
  inputs: [{ name: 'v', type: 'uint8' }],
  name: 'BadSignatureV',
  type: 'error'
})

badSignatureVError
//^?
```

### Human Readable ABIs

A Human Readable ABI can be parsed into a typed ABI object:

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

const badSignatureVError = AbiError.from(
  'error BadSignatureV(uint8 v)' // [!code hl]
)

badSignatureVError
//^?
```

It is possible to specify `struct`s along with your definitions:

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

const badSignatureVError = AbiError.from([
  'struct Signature { uint8 v; }', // [!code hl]
  'error BadSignatureV(Signature signature)'
])

badSignatureVError
//^?
```

## Definition

```ts
function from<abiError>(
  abiError: (abiError | AbiError | string | readonly string[]) & ((abiError extends string ? internal.Signature<abiError> : never) | (abiError extends readonly string[] ? internal.Signatures<abiError> : never) | AbiError),
  options?: from.Options,
): from.ReturnType<abiError>
```

## Parameters

### abiError

* **Type:** `(abiError | AbiError | string | readonly string[]) & ((abiError extends string ? internal.Signature<abiError> : never) | (abiError extends readonly string[] ? internal.Signatures<abiError> : never) | AbiError)`

The ABI Error to parse.

### options

* **Type:** `from.Options`
* **Optional**

#### options.prepare

* **Type:** `boolean`
* **Optional**

Whether or not to prepare the extracted function (optimization for encoding performance).
When `true`, the `hash` property is computed and included in the returned value.

## Return Type

Typed ABI Error.

`from.ReturnType<abiError>`
