| Crates.io | ohsol |
| lib.rs | ohsol |
| version | 0.1.0 |
| created_at | 2025-12-09 12:46:38.241983+00 |
| updated_at | 2025-12-09 12:46:38.241983+00 |
| description | Decode Solana program errors with style |
| homepage | https://github.com/cargopete/ohsol |
| repository | https://github.com/cargopete/ohsol |
| max_upload_size | |
| id | 1975425 |
| size | 213,228 |
A Rust CLI tool for decoding Solana program errors. Turns cryptic error codes like 0x1771 into human-readable messages.
cargo install --path .
Or build from source:
cargo build --release
./target/release/ohsol --help
Decode hex or decimal error codes:
# Hex format
ohsol decode 0x1771
# Decimal format
ohsol decode 6001
# With program context
ohsol decode 17 --program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
Fetch and decode errors from a transaction signature:
ohsol tx 5h6xBEauJ3PK6iKvmVCQfVwJyXKPhvwSeNada5ZpW8cGzLkPreF3r5mNVUXqkJ8G5gZq7mW8y7HX8p9vFxM6p3No
List all errors for a known program:
# By program name
ohsol list spl-token
ohsol list jupiter
# By program ID
ohsol list TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
Download and display a program's IDL:
# Print to stdout
ohsol idl 6khKp4BeJpCjBY1Eh39ybiqbfRnrn2UzWeUARjQLXYRC
# Save to file
ohsol idl 6khKp4BeJpCjBY1Eh39ybiqbfRnrn2UzWeUARjQLXYRC -o program.json
Extract and decode errors from piped input:
solana logs --program YourProgram | ohsol decode --stdin
All commands support JSON output with --json:
ohsol decode 0x1771 --json
ohsol list spl-token --json
Built-in error databases for:
spl-token)jupiter)For other programs, ohsol will attempt to fetch the IDL on-chain.
0-99: Anchor instruction errors100-999: Anchor instruction errors1000-1999: IDL errors2000-2999: Constraint errors (ConstraintMut, ConstraintSeeds, etc.)3000-4099: Account errors4100-4999: Miscellaneous Anchor errors6000+: Custom program errorsSet RPC URL via environment variable or flag:
export SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
Or use the flag:
ohsol tx <signature> --rpc-url https://api.devnet.solana.com
# Decode a constraint error
$ ohsol decode 2006
Error 2006 (0x7d6)
Program: Anchor Framework
Name: ConstraintSeeds
Message: A seeds constraint was violated
# List SPL Token errors
$ ohsol list spl-token
Known errors for spl-token (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA):
┌──────┬──────┬───────────────────┬─────────────────────────────────────────┐
│ Code │ Hex │ Name │ Message │
├──────┼──────┼───────────────────┼─────────────────────────────────────────┤
│ 0 │ 0x0 │ NotRentExempt │ Lamport balance below rent-exempt... │
│ 1 │ 0x1 │ InsufficientFunds │ Insufficient funds │
│ 17 │ 0x11 │ AccountFrozen │ Account is frozen │
└──────┴──────┴───────────────────┴─────────────────────────────────────────┘
MIT