Skip to main content

Overview

When working with Solidity smart contracts, you’ve probably encountered cryptic error messages like:
These errors are frustrating because you only get a 4-byte error selector (e.g., 0x118cdaa7) with no human-readable message. The @fhenixprotocol/cofhe-errors package provides instant, human-readable error decoding for CoFHE smart contracts.

What's Inside

  • 53 custom errors from 13 smart contracts
  • Complete error signatures with parameter types
  • Source contract information
  • Fast CLI lookup tool
  • Programmatic JavaScript/TypeScript API

Quick Start

No installation required! Use npx to decode errors immediately:
Output:

Installation (Optional)

Only install if you need to import the error database programmatically in your code:

CLI Usage

Decode an Error Selector

When you see “execution reverted: 0x…”, decode it instantly:

Search Errors by Name

Find errors when you know part of the error name:
Output:

List All Known Errors

Browse the complete error database:

JSON Output

Get JSON output for scripting and automation:
Output:

Programmatic API

JavaScript/TypeScript Usage

TypeScript with Types

Error Monitoring Example

Error Coverage

The package includes errors from the following contracts:
ContractError Count
TaskManager16
ACL8
SafeCast4
ERC1967Utils4
Errors4
Ownable2StepUpgradeable4
ECDSA3
Strings3
Common2
UUPSUpgradeable2
Address1
FHE1
PlaintextsStorage1

How Error Selectors Work

Solidity custom errors use a 4-byte selector computed as:
Example:
Becomes:
  • Signature: OwnableUnauthorizedAccount(address)
  • Selector: keccak256("OwnableUnauthorizedAccount(address)") = 0x118cdaa7...
  • First 4 bytes: 0x118cdaa7

Next Steps