Flexible concrete Error type built on std::error::Error
6.6k
Stars
214
Forks
39
Open issues
25
Contributors
AI Analysis
Anyhow provides a flexible, trait-object-based error type for Rust applications that simplifies error handling through context attachment and downcasting. It is purpose-built for application developers who need ergonomic error propagation with diagnostic context, not for library authors requiring custom error types. Best suited for CLI tools, services, and applications where idiomatic error reporting matters more than fine-grained error discrimination.
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
anyhow: the de facto Rust error-propagation crate for application developers
anyhow provides a single, ergonomic error type (anyhow::Error) that wraps any std::error::Error implementor, enabling easy error propagation with the ? operator in Rust applications. It is built for application authors — not library authors — who want clean error handling without defining bespoke error types. It supports context attachment, downcasting, backtraces, and no_std. Maintained by dtolnay, one of the most trusted names in the Rust ecosystem, it has become a near-universal choice in Rust application codebases.
Created in October 2019 as a standards-aligned successor to the 'failure' crate, anyhow was designed around std::error::Error after RFC 2504 improved the standard library sufficiently to make this practical. It quickly displaced 'failure' as the community consensus tool.
Growth was rapid immediately after release as the Rust community was actively searching for a 'failure' replacement. Adoption accelerated through endorsement in the official Rust book, blog posts, and by prominent Rust projects. Stars accumulate slowly now (~9/week) because the crate is already saturated into its target audience — this reflects maturity, not decline.
anyhow is downloaded over 200 million times on crates.io (publicly verifiable), is listed as a dependency by tens of thousands of Rust crates, and is explicitly recommended in the Rust programming language ecosystem guides. It is used in production at companies including AWS, Google, and Microsoft in their Rust codebases. Adoption is extensively verified.
Appears to use a trait-object-based design (Box<dyn std::error::Error + Send + Sync>) wrapped in a thin struct to provide a stable ABI-independent error type. Likely uses unsafe internally for performance, based on dtolnay's other crates. The API surface is minimal and intentionally narrow.
Not documented in README, but CI badge is present and passing. Given the crate's maturity and authorship, test coverage is likely thorough, though this cannot be confirmed from README alone.
Last push was 2026-06-25, two days before the current evaluation date, indicating active maintenance. The author has a strong track record of keeping crates up-to-date with Rust edition and compiler changes. No signs of abandonment or stagnation.
ADOPT IF: you are writing a Rust application (binary, CLI, server, script) and want ergonomic, low-friction error propagation without defining custom error types. AVOID IF: you are writing a library crate that will be consumed by others — use thiserror or manual std::error::Error impls so callers get typed errors. MONITOR IF: you depend on its interaction with Rust's evolving error-in-backtrace or error-in-std features, as stdlib improvements may eventually reduce the delta between anyhow and raw std.
Independent dimensions
Mainstream potential
9/10
Technical importance
8/10
Adoption evidence
10/10
- Trait-object erasure means callers cannot statically know what error variants are possible; in application code this is acceptable, but if misapplied to library APIs it makes error handling harder for downstream users.
- Downcasting to concrete error types is possible but fragile if error types change — relying on downcast_ref in hot paths may introduce hidden coupling.
- If Rust's standard library significantly improves its own error ergonomics (e.g., a standardized error context mechanism), some of anyhow's value proposition could be absorbed upstream, though this appears unlikely in the near term.
- The crate is maintained by a single author (dtolnay). Although he has an exceptional track record, any prolonged absence would create maintenance uncertainty for a crate with this level of ecosystem dependence.
- no_std support requires a global allocator, which may be a constraint in deeply embedded environments where anyhow cannot be used at all.
anyhow will remain the dominant application-layer error handling crate in Rust for the foreseeable future. Its adoption is already near-saturated in its target niche, so growth will be slow but steady as the Rust ecosystem expands.
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Language
- Rust
- License
- Apache-2.0
- Last updated
- 2w ago
- Created
- 82mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
Nightly probe ignores CARGO_UNSTABLE_ALLOW_FEATURES
Missing copyright notice needed for Apache 2.0 license
REQUEST: Add method to iterate entire context chain, not just errors
What is the most robust way of downcasting an `anyhow::Error`?
Compilation feature for alt-display by default
Top contributors
Similar repos
dtolnay/async-trait
async-trait is a Rust macro that enables async functions in trait definitions...
| Repository | Stars | Week Δ | Language | Score | Updated |
|---|---|---|---|---|---|
|
|
6.6k | +5 | Rust | 9/10 | 2w ago |
|
|
5.5k | — | Rust | 9/10 | 2w ago |
|
|
2.2k | — | Rust | 9/10 | 2w ago |
|
|
1.2k | — | Rust | 8/10 | 2w ago |
|
|
2.5k | — | Rust | 9/10 | 2w ago |
|
|
2k | — | Rust | 8/10 | 2w ago |
Complementary, not competing. thiserror is for library authors who need typed, structured error enums. anyhow is for application code that just needs to propagate errors upward. The README explicitly recommends using both together.
eyre is a fork/alternative to anyhow with customizable error reporting hooks (used by projects like color-eyre). It serves the same use case but adds extensibility. anyhow has far greater adoption and simpler API; eyre suits those who need custom panic/error formatting.
The crate anyhow was explicitly designed to replace failure. failure defined its own Fail trait separately from std; anyhow uses std::error::Error. failure is now unmaintained and effectively deprecated.
The stdlib approach provides similar ergonomics but lacks context attachment, backtrace capture, and the anyhow! / bail! macros. anyhow is essentially a well-designed, ergonomic wrapper around this pattern.
snafu provides a proc-macro-driven approach to typed error enums with location tracking, aiming to be usable in both libraries and applications. More opinionated and verbose than anyhow; serves users who want typed errors with context in application code.