Description
errtrace is an experimental Go package that records a return trace for errors, the path an error takes through the functions it returns through, as an alternative to a stack trace. A stack trace records the code path that led to an error when the error was created. A return trace records the location of each function the error passes back through, so it still works when an error is sent across goroutines or channels, where the stack trace can be misleading. The approach is inspired by Zig's error return traces. The README lists its features: it has no other runtime dependencies, its API is simple and idiomatic, and an errtrace CLI can automatically instrument your code. It also says it is much faster than capturing a stack trace on popular 64-bit systems. The project covers manual and automatic instrumentation, performance, caveats, error wrapping and safety. Because it is experimental, the README asks you to check those caveats before you rely on it.…
Highlights
- Return traces for Go errors
- Works across goroutines and channels
- No other runtime dependencies
- CLI that instruments code automatically
- Faster than capturing a stack trace
Ratings & Reviews
No ratings yet
Be the first to rate Errtrace.
People also visit

golang-troubleshooting
Troubleshoot Golang programs systematically - find and fix the root cause
Errtrace FAQ
What is errtrace?
An experimental Go package that records the path an error takes back through the code, as an alternative to a stack trace.
How is it different from a stack trace?
A stack trace records where an error was created. A return trace records each function the error returns through, which helps when errors pass through channels or goroutines.
Does it add dependencies?
No. The README says it brings no other runtime dependencies.
How do I add it to my code?
The README covers manual instrumentation, and automatic instrumentation with the errtrace CLI.
Is it ready for production?
It is described as experimental, so read the README's caveats and safety notes before you rely on it.
What are the best Errtrace alternatives?
Popular alternatives to Errtrace include TrackJS and Btrace. See all Errtrace alternatives








