anyhow

Flexible, idiomatic error handling for Rust applications with a single concrete error type.

Library
Cargo
v1.0.104
6,657 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
67 /100 Good
Development Activity 48
Maintenance 68
Community 52
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
93 /100 Excellent
Architecture 92
Code Quality 95
Innovation 94
Learning Curve 90

anyhow provides anyhow::Error, a trait-object-based error type that makes error handling in Rust application code effortless. Instead of defining bespoke error enums for every fallible function, you return anyhow::Result<T> and let the ? operator propagate any error that implements std::error::Error.

Beyond simple propagation, anyhow lets you attach human-readable context to errors, automatically captures backtraces on recent Rust versions, and supports downcasting back to concrete error types when you need to branch on the underlying cause. It works in both std and no_std environments and pairs naturally with thiserror for library-defined error types.

What You Get

  • A single anyhow::Error type and anyhow::Result<T> alias that absorb any std::error::Error via the ? operator
  • The Context / with_context API for attaching descriptive, low-overhead context to errors as they propagate
  • The anyhow! and bail! macros for constructing and early-returning ad-hoc errors with format-string interpolation
  • Automatic backtrace capture (Rust >= 1.65) and downcasting back to concrete error types by value or reference
  • no_std support (with a global allocator) exposing nearly the same API surface

Common Use Cases

  • Returning errors from application main, CLI tools, and glue code without defining custom error enums
  • Adding context to low-level errors so failures are debuggable (“Failed to read config from …”)
  • Propagating heterogeneous errors from many libraries through one uniform result type
  • Inspecting or branching on a root cause via downcasting when specific handling is required

Under The Hood

Architecture — The crate centers on a single Error type (src/error.rs) that is a thin, pointer-width wrapper around a heap-allocated ErrorImpl reached through custom fat/thin pointer machinery in src/ptr.rs (Own, Ref, Mut), letting one word carry the error plus a vtable of type-erased operations (display, debug, downcast, backtrace). src/context.rs implements the Context trait that layers messages onto the cause chain, src/chain.rs provides iteration over the Caused by: sources, src/fmt.rs renders the chain and backtrace, and src/backtrace.rs gates capture behind Rust-version and feature cfgs. Tech Stack — Pure Rust (edition 2021, MSRV 1.68), zero required runtime dependencies, with a build.rs probe that feature-detects compiler capabilities (core error trait, generic member access, backtrace support) and sets cfgs so the same source compiles across a wide range of toolchains and std/no_std. Dev-only dependencies (thiserror, trybuild, rustversion, syn, futures) exist purely for the test suite. Code Quality — Exceptionally high: 14 integration test files under tests/ cover downcasting, context, ffi, boxed conversion, fmt, macros, source chains, and drop behavior, plus trybuild compile-fail UI tests that pin exact error messages. The code is unsafe-heavy by necessity (manual pointer tagging) but tightly encapsulated behind safe APIs and maintained by a single expert author with meticulous cfg discipline. API Design — Best-in-class developer experience: getting started needs only use anyhow::Result and the ? operator, context is one .context("...") call away, and the anyhow!/bail! macros read naturally. Documentation is thorough with runnable doctests on every public item, and the API deliberately mirrors familiar Result/Error idioms so the learning curve is minimal.

Used by 50 apps in this directory

Rust
64%
Apache 2.0

Temps

Analytics · Devops · Monitoring

801

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
70
Dependency
Built with
Rust 64%
TypeScript 34%
Updated 1 weeks ago
Rust
79%
Apache 2.0

TensorZero

Ab Testing Experimentation · AI Development · Monitoring

11,717

TensorZero unifies the LLM gateway, observability, evaluation, optimization, and experimentation stack behind a single OpenAI-compatible API, built in Rust for sub-millisecond p99 latency.

View details
53
Repo Health
87
Technical
69
Dependency
Built with
Rust 79%
TypeScript 15%
Updated 4 months ago
Rust
50%
Apache 2.0

Vibe Kanban

AI Agents · AI Code Assistants · Project Management

28,209

A kanban board for planning work and dispatching Claude Code, Codex, Gemini CLI, and eight other coding agents into isolated git worktrees, then reviewing and merging their diffs from one UI.

View details
75
Repo Health
75
Technical
64
Dependency
Built with
Rust 50%
TypeScript 46%
Updated 2 weeks ago
Rust
97%
Apache 2.0

Volga

Data Engineering

161

A Rust-based real-time data processing engine for AI/ML feature computation, built on Apache DataFusion and Arrow — positioned as an alternative to Flink, Spark, Chronon, and OpenMLDB with unified streaming, batch, and request-time execution.

View details
67
Repo Health
67
Technical
72
Dependency
Built with
Rust 97%
Updated 1 weeks ago
Rust
32%
Other

Windmill

Automation · Developer Tools

18,043

Turn scripts into webhooks, workflows, and auto-generated UIs — the fastest self-hostable workflow engine, 13x faster than Airflow.

View details
91
Repo Health
82
Technical
65
Dependency
Built with
Rust 32%
TypeScript 24%
Svelte 22%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers