---
title: "Decode an error"
description: "Turn a custom program error code or a transaction signature into a name, a message and the failing instruction."
url: https://barestate.xyz/docs/guides/decode-an-error
---

# Decode an error

> Turn a custom program error code or a transaction signature into a name, a message and the failing instruction.

You have a failing transaction and a hex code, or just a signature, and you want to know what went wrong. `/error` turns a code into a name and message, and `/tx` shows a transaction on your local chain. Neither uses a model turn.

## Decode a code

```text
/error 3012
/error 0xbc4
/error <code> <program>
```

OMS accepts decimal codes, hex codes, and the text `custom program error: 0x...`. To narrow the match, pass a program name or id. Codes 6000 and above are defined by the program itself, so OMS needs your project's IDL or the program to name them.

OMS looks in its offline tables first, then in the IDLs under your task's `target/idl`, and only then asks its Solana reference service. See [Error decoding](https://barestate.xyz/docs/concepts/error-decoding).

## Look at a transaction

```text
/tx <signature>
```

This shows the status, error, compute units and logs for a transaction on the local Surfpool.

## When a command fails inside a session

If a failing command prints `InstructionError`, `Program ... failed:`, `AnchorError` or `custom program error`, OMS adds a short diagnosis to the output. It names the failed program, the error, the instruction, the account name from the IDL and the compute units, and the full log stays available through the `raw_output` tool.

## If the code is not found

When no offline table, IDL or reference entry knows the code, OMS cannot name it. Your project's errors come from `target/idl/*.json` (at most 16 files, 1,000,000 bytes each), so make sure the IDL exists there and run `/error` again.
