Skip to content
Researched developer tool comparisonsPrices dated · vendor sources linked · no star ratings
Search

Stage 01 · Write · Researched comparison

Best Rust Error Handling Libraries in 2026

thiserror is the first pick for most projects that define their own error enums, because it generates Display and Error implementations from attributes with no runtime cost. anyhow suits applications that need one boxed error type with context chains. eyre adds report formatting and optional backtraces for binaries, while snafu and miette cover context-heavy and diagnostic-heavy code.

By
Published 27 Nov 2026 · 6 tools compared

We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.

Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.

Key takeaways

  • thiserror and anyhow are the most widely used crates for library and application errors respectively, and both are Free (open source).
  • eyre targets binaries that need readable error reports and backtraces.
  • miette focuses on diagnostic output with spans and labels, useful for compilers and CLI tools.
  • All options listed are open-source crates under MIT or Apache-2.0 licences, and none require sending data to a third party.

Who each pick is for

  • Library authors defining custom error enumsthiserror
  • Applications that need one boxed error type with contextanyhow
  • CLI tools that want formatted error reportseyre
  • Codebases that want explicit context selectorssnafu
  • Tools that need diagnostic output with spansmiette
  • Projects that want no extra dependenciesstd::error::Error

Comparison

The 6 tools at a glance
ToolBest forStandout featureListed starting priceFree plan or trial
1thiserrorLibrary authors defining custom error enumsDerive macros generate Display and Error implsFree (open source)Free plan
2anyhowApplications that need one boxed error type with contextSimple anyhow::Result aliasFree (open source)Free plan
3eyreCLI tools that want formatted error reportsCustom report handlerFree (open source)Free plan
4snafuCodebases that want explicit context selectorsContext selectors generate typed contextFree (open source)Free plan
5mietteTools that need diagnostic output with spansRich diagnostic rendering with labels and spansFree (open source)Free plan
6std::error::ErrorProjects that want no extra dependenciesPart of the standard libraryFreeFree plan

How we picked

We compared crates on fit for the job (library versus application errors, context, backtraces, diagnostics), platform and toolchain support including no_std, licence terms, and the main limits each crate documents. Sources are the official crate repositories and documentation, plus the standard library docs for the built-in trait. Prices and licences can change, so confirm details on each project page before you commit.

The tools, one by one

01

thiserror

Best for library authors defining custom error enums

Visit github.com
thiserror homepage
thiserror homepage, captured Nov 2026

What it is and where it fits

thiserror provides derive macros for the standard library's Error trait. You annotate an enum with #[derive(Error)] and use attributes such as #[error("...")] to generate Display implementations and #[from] to generate From conversions. The generated code is what you would write by hand, so there is no runtime cost.

It targets library crates that need a concrete, typed error enum callers can match on. It works on stable Rust and supports no_std when the standard error trait is available. The crate is dual-licensed MIT or Apache-2.0. It does not provide context chaining or backtraces, so it is usually paired with anyhow at the application boundary. Skip it if you want a single opaque error type across a whole binary.

Standout: Derive macros generate Display and Error impls

Pricing pointer

Free (open source), as listed by the vendor (thiserror website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Derive macros generate Display and Error impls
  • no runtime overhead
  • works in no_std contexts

Drawbacks

  • No built-in context chaining
  • you write the enum variants yourself

Skip it if this limit matters to you: no built-in context chaining.

Verdict. A sensible pick for library authors defining custom error enums.

Alternatives in this guide: anyhow, eyre, snafu

02

anyhow

Best for applications that need one boxed error type with context

Visit github.com
anyhow homepage
anyhow homepage, captured Nov 2026

What it is and where it fits

anyhow provides a dynamic error type built on Box<dyn Error>. Its Result alias and the ? operator make it quick to propagate failures, and the context and with_context methods attach human-readable messages as the error travels up the call stack. Backtrace capture is available when the Rust version supports it.

It suits binaries and internal tools where callers do not need to match on specific error variants. The crate is Free (open source) under MIT or Apache-2.0 and works on stable Rust. The main limit is API design: exposing anyhow::Error from a public library forces downstream users into a dynamic type. Pair it with thiserror inside libraries and convert at the application edge.

Standout: Simple anyhow::Result alias

Pricing pointer

Free (open source), as listed by the vendor (anyhow website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Simple anyhow::Result alias
  • .context() and .with_context() add messages
  • captures backtraces on nightly and recent stable

Drawbacks

  • Not designed for public library APIs
  • error type is opaque to callers

Skip it if this limit matters to you: not designed for public library APIs.

Verdict. A sensible pick for applications that need one boxed error type with context.

Alternatives in this guide: thiserror, eyre, snafu

03

eyre

Best for cLI tools that want formatted error reports

Visit github.com
eyre homepage
eyre homepage, captured Nov 2026

What it is and where it fits

eyre is a fork of anyhow that lets you customize how errors are reported. It defines a Report type and a Result alias, and it exposes a hook for installing a custom report handler.

It fits command-line tools and services where the final error output matters to a human reader. The crate is Free (open source) under MIT or Apache-2.0 and runs on stable Rust. Because it is a fork, some ecosystem crates integrate with anyhow rather than eyre. Skip it if you do not need custom report formatting and prefer the larger anyhow user base.

Standout: Custom report handler

Pricing pointer

Free (open source), as listed by the vendor (eyre website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Custom report handler
  • ergonomic Result alias

Drawbacks

  • Smaller ecosystem than anyhow
  • report formatting needs configuration

Skip it if this limit matters to you: smaller ecosystem than anyhow.

Verdict. A sensible pick for CLI tools that want formatted error reports.

Alternatives in this guide: thiserror, anyhow, snafu

04

snafu

Best for codebases that want explicit context selectors

Visit github.com
snafu homepage
snafu homepage, captured Nov 2026

What it is and where it fits

snafu generates context selector types alongside your error enum. Each variant gets a selector struct that implements a Context trait, so call sites read like .context(ReadConfigSnippet)? and the resulting error carries the fields you declared. This makes context explicit and typed rather than string-based.

It suits larger codebases and embedded projects that need no_std support and careful control over error context. The crate is Free (open source) under MIT or Apache-2.0. The tradeoff is more generated code and a steeper learning curve than thiserror. Skip it for small projects where a plain enum and the ? operator are enough.

Standout: Context selectors generate typed context

Pricing pointer

Free (open source), as listed by the vendor (snafu website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Context selectors generate typed context
  • works with no_std
  • supports backtraces

Drawbacks

  • More boilerplate than thiserror
  • smaller user base

Skip it if this limit matters to you: more boilerplate than thiserror.

Verdict. A sensible pick for codebases that want explicit context selectors.

Alternatives in this guide: thiserror, anyhow, eyre

05

miette

Best for tools that need diagnostic output with spans

Visit github.com
miette homepage
miette homepage, captured Nov 2026

What it is and where it fits

miette is a diagnostic library rather than a plain error crate. It defines a Diagnostic trait with labels, help text and source spans, and it can render errors against the source file that caused them, similar to compiler output. A derive macro reduces boilerplate for custom diagnostic types.

It fits parsers, linters, compilers and CLI tools where pointing at the offending source line matters. The crate is Free (open source) under Apache-2.0. It runs on stable Rust and can be used alongside thiserror or anyhow for the underlying error type. The rendering stack pulls in more dependencies than a minimal error crate, so skip it for services that only log error strings.

Standout: Rich diagnostic rendering with labels and spans

Pricing pointer

Free (open source), as listed by the vendor (miette website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Rich diagnostic rendering with labels and spans
  • derive macro for error types
  • integrates with source code display

Drawbacks

  • Heavier than plain error crates
  • rendering features add dependencies

Skip it if this limit matters to you: heavier than plain error crates.

Verdict. A sensible pick for tools that need diagnostic output with spans.

Alternatives in this guide: thiserror, anyhow, eyre

06

std::error::Error

Best for projects that want no extra dependencies

Visit doc.rust-lang.org
std::error::Error homepage
std::error::Error homepage, captured Nov 2026

What it is and where it fits

The Error trait in the standard library is the foundation the other crates build on. Implementing it by hand, together with Display from std::fmt, gives you a typed error with a source chain and no third-party dependency. Recent Rust versions have expanded the trait with methods such as provide for downcasting.

It suits small crates, embedded projects and teams with strict dependency policies. It is Free and ships with the toolchain. The cost is boilerplate: you write Display and Error impls yourself and build context chains manually. For anything beyond a few error variants, a derive-based crate usually saves time. Skip the manual route if you expect many variants or frequent changes.

Standout: Part of the standard library

Pricing pointer

Free, as listed by the vendor (std::error::Error website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Part of the standard library
  • no dependency to audit
  • stable trait

Drawbacks

  • Manual Display and Error impls
  • no derive macros or context helpers

Skip it if this limit matters to you: manual Display and Error impls.

Verdict. A sensible pick for projects that want no extra dependencies.

Alternatives in this guide: thiserror, anyhow, eyre

Who should use what

If you are publishing a library crate, start with thiserror so callers can match on typed variants. If you are writing a binary or internal service, anyhow gives you fast propagation with context. If your CLI prints errors to a terminal and you want readable error reports, use eyre. If you are building a parser, linter or compiler and need to point at source spans, use miette. Teams with strict dependency rules can implement std::error::Error by hand.

Questions to settle before you buy

What to check before you buy

  • Decide whether the crate is a library (typed errors) or an application (boxed errors) before picking.
  • Check that the crate supports your minimum Rust version and any no_std target you build for.
  • Confirm the licence matches your project's policy; most listed crates are MIT or Apache-2.0.
  • Verify how backtraces are captured on your toolchain, since support varies by Rust version.
  • Review the dependency tree, especially for diagnostic crates that render source spans.

FAQ

What is the difference between thiserror and anyhow?

thiserror generates typed error enums for library APIs, so callers can match on variants. anyhow provides one boxed error type for applications, with context methods for adding messages. Many projects use thiserror inside libraries and anyhow at the application boundary.

Do these crates send my data anywhere?

No. They are compile-time libraries that run inside your binary. Error messages and backtraces stay local. There is no network call and no third-party service involved, so no secrets leave your machine through these crates.

Can I use these crates in no_std projects?

thiserror and snafu document no_std support. anyhow and eyre are aimed at applications with the standard library. Check each crate's documentation for the exact feature flags and target requirements before relying on it in embedded code.

Which crate should I use for CLI error output?

eyre produces formatted error reports for terminal output. miette is the better choice when you need to show source spans and labels. Plain anyhow works if you only need readable messages without styling.

Are these libraries free?

Yes. All the crates listed are open source and free to use. thiserror, anyhow, eyre and snafu are dual-licensed MIT or Apache-2.0, miette is Apache-2.0, and the standard library trait ships with Rust.

Sources we checked

Method: how we score · editorial policy.

  1. thiserror (official site)
  2. anyhow (official site)
  3. eyre (official site)
  4. snafu (official site)
  5. miette (official site)
  6. std::error::Error (official site)

Change log. First published 27 Nov 2026.