Skip to content

Assert/Require Misuse and Improper Error Handling

SAFE-0097 Best Practice Checked automatically by the scanner
1

What goes wrong

Using assert for input validation (consuming all gas pre-0.8 / signaling a bug), or empty require/catch blocks that swallow failures, leads to poor failure modes and hidden errors.

2

How to fix it

the pattern that is safe
require(msg.value > 0, "no value"); // assert reserved for true invariants
SWC-110. Correctly separate require vs assert.
3

Where this has happened

Largest recorded losses in the same failure class — related, not the same bug:

Check your own contract for this

The SaferICO scanner runs 201 detectors over your Solidity source, SAFE-0097 among them. Paste an address or the source itself — a small per-scan fee, shown before you sign, or unlimited on any plan.

Run the scanner See how it is attacked Read the docs