In this track: Read logs and failures
advanced · 4 MIN READ

Decode Error(string)

A common revert format carries a dynamic message.

LET’S PICTURE IT

An unsuccessful action can return a labeled explanation envelope.

SEE IT FOR YOURSELF
Follow a revert and decode its error dataStep 1 / 4
Follow a revert and decode its error dataRequested actionTransfer 100 raw unitsExample inputsAvailable balance40 raw unitsCheck the ruleA deliberately failing local scenario, not a live transactionCondition fails100 > 40Request rejectedRollbackNo successful transferConsumed gas still mattersTop-level failure and a caught nested failure have different contextsError selector0x08c379a04 bytesMessage tailNot enough tokensDynamic string encodingCustom errors and Panic use different selectors and schemasDecoded messageNot enough tokensA diagnostic clueFurther evidenceCaller and code pathRelevant stateError bytes can be constructed by code; decoding is not authentication

This fictional call requests a transfer of one hundred raw units while the relevant balance is forty.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Recognize the selector

The standard Error(string) selector is 0x08c379a0. It prefixes ABI-encoded error arguments, much like a function selector prefixes ordinary function arguments.

Follow the string offset

The argument tuple starts after the four-byte selector. Its first word points thirty-two bytes forward to the string length word.

Read the length and content

Use the declared UTF-8 byte length, then read that many message bytes. Padding completes the content word but is not part of the message.

Keep the message in context

A decoded explanation is diagnostic data supplied by code. It does not authenticate the emitting source or establish that the stated explanation is truthful.

Inspect the example

0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f4e6f207469636b657473206c6566740000000000000000000000000000000000

Message: No tickets left. Paste these bytes into the revert decoder.

TURN UNDERSTANDING INTO PRACTICEOpen the Revert decoder →
QUICK CHECK · NO PRESSURE

What follows 0x08c379a0 in a standard Error(string)?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.