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

TypeScript
54%
MIT

Anarlog

AI Assistants · Note Taking · Productivity

9,404

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
68
Dependency
Built with
TypeScript 54%
Rust 34%
Updated 4 days ago
Dart
74%
AGPL 3.0

AppFlowy

AI Assistants · Collaboration · Productivity

76,967

The open-source AI workspace that puts your data, your rules — with local LLMs, CRDT collaboration, and full self-hosting built in.

View details
66
Repo Health
81
Technical
67
Dependency
Built with
Dart 74%
Rust 24%
Updated 1 weeks ago
TypeScript
45%
AGPL 3.0

BrowserOS

AI Assistants · Browser

13,763

The open-source agentic Chromium browser with native AI agents, MCP server, and visual workflow automation — your data never leaves your machine.

View details
87
Repo Health
82
Technical
68
Dependency
Built with
TypeScript 45%
Rust 23%
Python 18%
Updated 4 days ago
Rust
67%
MIT

Bun

Developer Tools

96,068

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
64
Dependency
Built with
Rust 67%
C++ 19%
TypeScript 10%
Updated 5 days ago
Rust
54%
Other

Cameleer

AI Agents

23

A local-first desktop workspace for managing AI agents in an enterprise-style workflow — agent directory, Kanban task tracking, workspace chat, and a full runtime/audit log of agent actions and tool approvals.

View details
40
Repo Health
65
Technical
76
Dependency
Built with
Rust 54%
JavaScript 24%
TypeScript 15%
Updated 2 months ago
Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
Rust
95%
Other

Databend

Data Engineering · Databases

9,452

Open-source enterprise data warehouse unifying analytics, vector search, full-text search, and AI agent orchestration in a single Rust-built engine on S3.

View details
93
Repo Health
84
Technical
77
Dependency
Built with
Rust 95%
Updated 4 days ago
TypeScript
88%
MIT

DevTools-X

Developer Tools

1,534

41 offline-first developer utilities in a single 10MB cross-platform desktop app — no Electron, no cloud, no compromise.

View details
49
Repo Health
68
Technical
68
Dependency
Built with
TypeScript 88%
Updated 4 months ago
TypeScript
64%
Other

Epicenter

Developer Tools · Knowledge Management · Note Taking

4,808

A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.

View details
88
Repo Health
90
Technical
64
Dependency
Built with
TypeScript 64%
HTML 13%
Svelte 13%
Updated 5 days 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