> ## Documentation Index
> Fetch the complete documentation index at: https://cosmos-docs-cosmjs-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Encoding Errors

> Protobuf registry, Bech32, hex, Base64, and public key encoding errors.

These errors occur when encoding or decoding data — Protobuf messages, Bech32 addresses, hex strings, Base64, and public keys. Most are caused by missing type registrations or malformed input.

## Registry (Protobuf)

Thrown when encoding or decoding a message whose type URL is not registered:

```
"Unregistered type url: /my.custom.MsgCustom"
```

Fix: register the type before use:

```typescript theme={"system"}
import { Registry } from "@cosmjs/proto-signing";
import { defaultRegistryTypes } from "@cosmjs/stargate";

const registry = new Registry(defaultRegistryTypes);
registry.register("/my.custom.MsgCustom", MsgCustom);
```

Also thrown for malformed `Any` values:

```
"Missing type_url in Any"
"Missing value in Any"
```

## Bech32

Thrown by `fromBech32` for invalid addresses:

```
"No bech32 separator found"           // String has no '1' separator
"invalid checksum"                     // Corrupted or wrong address
"must be lowercase or uppercase"       // Mixed case
"length X exceeds limit Y"            // Address too long
```

## Hex

```
"hex string length must be a multiple of 2"
"hex string contains invalid characters"
```

## Base64

```
"Invalid base64 string format"
```

## Pubkey Type

Thrown when an unrecognized public key type is encountered during
encoding/decoding:

```
"Unsupported pubkey type"
"Pubkey type_url '...' not recognized as single public key type"
"Pubkey type URL '...' not recognized"
```
