miette
Fancy diagnostic reporting library for Rust. Provides beautiful, human-readable error messages with source code context, highlighted spans, and suggestions — similar to Rust compiler error messages. Uses the Diagnostic trait extending std::error::Error with labels, help text, and source code references. Works with #[derive(Diagnostic)] for easy adoption.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Error diagnostic library — ensure source code shown in diagnostics doesn't contain sensitive values (credentials, PII in parsed configs).
⚡ Reliability
Best When
Building CLI tools, linters, parsers, or compilers where user-facing errors benefit from source context and suggestions.
Avoid When
Building libraries or server applications — miette is best for user-facing CLI diagnostics.
Use Cases
- • Display beautiful source-code-aware error messages in CLI tools — highlight the problematic token with arrows and labels
- • Implement compiler-style diagnostics for DSL parsers, configuration validators, or schema validators
- • Add contextual help text and suggestions to errors: 'Did you mean X?' with the derive macro
- • Produce rich error reports for end users in developer tools, linters, and code generators
- • Chain error sources with full context using miette::Report for debug output vs user-friendly display
Not For
- • Library error types that need to be consumed programmatically — use thiserror for library errors; miette for user-facing tools
- • Simple applications where anyhow suffices — miette adds complexity for tools that don't need source spans
- • High-frequency internal errors — miette's rich formatting has overhead; use thiserror for hot-path error types
Interface
Authentication
Library — no auth needed.
Pricing
Apache 2.0 licensed open source library.
Agent Metadata
Known Gotchas
- ⚠ miette requires enabling 'fancy' feature for terminal colors and fancy rendering: miette = { features = ['fancy'] } — default is plain text
- ⚠ SourceSpan uses byte offsets, not character offsets — multi-byte Unicode characters will cause misaligned highlights if char indices are used
- ⚠ Must set a custom ReportHandler via miette::set_hook() to customize rendering globally — the default handler uses plain text
- ⚠ Diagnostic trait requires a source string (NamedSource or SourceCode) to display code snippets — errors without source just show the message
- ⚠ miette::Report wraps errors for pretty display — use it in main() return types: fn main() -> miette::Result<()>
- ⚠ Derive macro requires miette = { features = ['derive'] } — derive feature is separate from the main crate features
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for miette.
Scores are editorial opinions as of 2026-03-06.