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

# AbiItem Errors

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

## `AbiItem.AmbiguityError`

Throws when ambiguous types are found on overloaded ABI items.

### Examples

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

const foo = Abi.from([
  'function foo(address)',
  'function foo(bytes20)'
])
AbiFunction.fromAbi(foo, 'foo', {
  args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e']
})
// @error: AbiItem.AmbiguityError: Found ambiguous types in overloaded ABI Items.
// @error: `bytes20` in `foo(bytes20)`, and
// @error: `address` in `foo(address)`
// @error: These types encode differently and cannot be distinguished at runtime.
// @error: Remove one of the ambiguous items in the ABI.
```

### Solution

Remove one of the ambiguous types from the ABI.

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

const foo = Abi.from([
  'function foo(address)',
  'function foo(bytes20)' // [!code --]
])
AbiFunction.fromAbi(foo, 'foo', {
  args: ['0xA0Cf798816D4b9b9866b5330EEa46a18382f251e']
})
// @error: AbiItem.AmbiguityError: Found ambiguous types in overloaded ABI Items.
// @error: `bytes20` in `foo(bytes20)`, and
// @error: `address` in `foo(address)`
// @error: These types encode differently and cannot be distinguished at runtime.
// @error: Remove one of the ambiguous items in the ABI.
```

## `AbiItem.InvalidAbiItemError`

## `AbiItem.InvalidSelectorSizeError`

Throws when the selector size is invalid.

### Examples

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

const foo = Abi.from([
  'function foo(address)',
  'function bar(uint)'
])
AbiFunction.fromAbi(foo, '0xaaa')
// @error: AbiItem.InvalidSelectorSizeError: Selector size is invalid. Expected 4 bytes. Received 2 bytes ("0xaaa").
```

### Solution

Ensure the selector size is 4 bytes.

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

const foo = Abi.from([
  'function foo(address)',
  'function bar(uint)'
])
AbiFunction.fromAbi(foo, '0x7af82b1a')
```

## `AbiItem.NotFoundError`

Throws when an ABI item is not found in the ABI.

### Examples

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

const foo = Abi.from([
  'function foo(address)',
  'function bar(uint)'
])
AbiFunction.fromAbi(foo, 'baz')
// @error: AbiItem.NotFoundError: ABI function with name "baz" not found.
```

### Solution

Ensure the ABI item exists on the ABI.

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

const foo = Abi.from([
  'function foo(address)',
  'function bar(uint)',
  'function baz(bool)' // [!code ++]
])
AbiFunction.fromAbi(foo, 'baz')
```

## `AbiItem.UnknownSolidityTypeError`

## `AbiItem.UnknownTypeError`
