stack trace
The list of function calls that were running when an error happened, printed to help a developer find where it came from; Python calls it a traceback.
In more detail
It is the first thing to read when a program crashes: it shows where the error was raised and the path of calls that led there. Different languages print the calls in different orders. Because it reveals file paths, library versions and sometimes data, record it in protected logs and send callers only a safe error message.
Examples
In the APIs course: The course leaky five hundred fault puts one into the error body.Go: an unrecovered panic prints a stack trace for each goroutine to standard errorA stack trace must never be a metric label value: it is unbounded and would create a new time series for every variant.In Python the stack trace is called a traceback and reads oldest call first.React also provides a component stack, listing the components that were rendering, which is often more useful for UI errors.In this course: Python calls it a traceback. Reading from the test into the code under test and on into a collaborator shows exactly which boundary the failure crossed. pytest can shorten or hide it with the --tb option when you only need the summary.Related terms
- exception — An error object a program raises to stop normal flow and report that something went wrong.
- leaky error — An error response that reveals private details such as a stack trace, a database query, a secret or internal names.
- log — A time-stamped record of an individual event in a system, such as one request being handled; structured logs record it as named fields rather than free text.
- call stack — The region of memory where a running program keeps one frame for each function call that has started but not yet returned.
- Problem Details — A standard JSON shape for HTTP error responses, defined in RFC 9457, with members such as type, title, status, detail and instance.
- panic — A Go run-time failure that stops normal execution, runs deferred functions and, unless recovered, crashes the program with a stack trace.
- race detector — A checking mode, turned on with -race, that makes a Go program report when two goroutines touch the same memory unsafely.
- standard output and standard error — The two channels a program writes normal output (stdout) and error messages (stderr) to, plus stdin for input.
- exception chaining — Linking a new exception to the one that caused it, so the higher-level failure still carries the original error and its stack trace.
- ERROR — The log level for work that was actually lost: a request failed and the user did not get what they asked for.
- cardinality — The number of distinct values a metric label can take, which multiplies how many separate series a metric creates.
- traceback — The report Python prints when an unhandled exception stops a program, listing the chain of calls that led there and ending with the error.
- componentDidCatch — A class lifecycle method React calls after a child error, receiving the error and an info object whose componentStack shows which components were rendering.
- debug mode — A setting that makes a service show detailed internals, such as stack traces and configuration, to help developers fix problems.
- distributed tracing — Following one request across every service, queue and database it touches by recording linked spans that share a trace identifier.
- --tb — The pytest option that chooses how much of each failure's traceback to print, from long to short to none.
- failure report — What the test runner prints when a test fails: which test, which line, and the values that did not match.
Taught in
- Filtering And Searching — Modern API Architecture: REST, GraphQL & gRPC
- Error Handling And Safe Retries — Modern API Architecture: REST, GraphQL & gRPC
- Problem Details: RFC 9457 — Modern API Architecture: REST, GraphQL & gRPC
- Async and Await: Managing Concurrency — Modern .NET Core, C# & Enterprise Microservices
- Global Exception Handling and Problem Details — Modern .NET Core, C# & Enterprise Microservices
- Parsing Arguments with flag — Concurrent Systems Programming with Go
- Checked Versus Unchecked Exceptions — Modern Java: Virtual Threads & High-Throughput Services
- Validation — Modern Java: Virtual Threads & High-Throughput Services
- Exception Handling To Problem Details — Modern Java: Virtual Threads & High-Throughput Services
- Checked, Unchecked, Catch And Finally — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Global Error Trapping: uncaughtException & Exits — Node.js Internals & Backend Services
- Log Levels Done Properly — Full-Stack Observability: Metrics, Tracing & Logging
- Cardinality And How It Bankrupts You — Full-Stack Observability: Metrics, Tracing & Logging
- Reading Error Messages — Hands-on Python: Complete Video Course & Book
- Reading A Traceback Like A Professional — Hands-on Python: Complete Video Course & Book
- Error Boundaries: componentDidCatch And Fallback UI Trees — React 19 & Modern Component Architecture
- Secure Defaults — Application Security & Threat Modeling for Engineers
- Monolith Versus Services: The Honest Trade Offs — Scalable System Design & Distributed Architecture
- The Cost And Value Of A Test — Automated Testing, TDD & Quality Engineering
- One Assertion Per Reason — Automated Testing, TDD & Quality Engineering
- What Test Doubles Are For — Automated Testing, TDD & Quality Engineering
References
- Python docs: traceback
- OWASP Cheat Sheet Series: Error handling
- Exception.StackTrace
- Package runtime/debug: PrintStack
- Java SE 21 API: Throwable
- CWE-209: Generation of Error Message Containing Sensitive Information
- MDN: Error.prototype.stack
- Python logging module
- OpenTelemetry documentation: Traces
- pytest: modifying Python traceback printing