# PublicKey Errors

## `PublicKey.InvalidCompressedPrefixError`

Thrown when the public key has an invalid prefix for a compressed public key.

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

## `PublicKey.InvalidError`

Thrown when a public key is invalid.

### Examples

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

PublicKey.assert({ y: '0x01' })
// @error: PublicKey.InvalidError: Value `{"y":"0x01"}` is not a valid public key.
// @error: Public key must contain:
// @error: - an `x` and `prefix` value (compressed)
// @error: - an `x`, `y`, and `prefix` value (uncompressed)
```

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

## `PublicKey.InvalidPrefixError`

Thrown when a public key has an invalid prefix.

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

## `PublicKey.InvalidSerializedSizeError`

Thrown when the public key has an invalid serialized size.

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

## `PublicKey.InvalidUncompressedPrefixError`

Thrown when the public key has an invalid prefix for an uncompressed public key.

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