Error Tracking & Monitoring

Breadcrumbs: The Context Stack Traces Miss

Breadcrumbs record the events leading up to a crash — clicks, requests, logs — so you can reproduce the exact path that broke your app.

A stack trace tells you what broke and where. But it doesn't tell you how you got there. A user clicked a button, filled a form, made a request that timed out, then triggered the crash. Without that sequence, you're debugging blind — you can see the line that failed, but not the path that led to it. Error breadcrumbs are the trail of events that precede a crash, captured automatically so you can reproduce exactly what the user did.

Breadcrumbs are one of the most underrated features of modern error tracking. They transform a cryptic stack trace into a narrative: "User navigated to /checkout, clicked 'Place Order', the API returned 500, then the JavaScript threw a TypeError." That context is what takes you from "I see the error" to "I can reproduce it" in minutes instead of hours.

What breadcrumbs are (and what they capture)

A breadcrumb is a timestamped record of an event that happened before an error occurred. The Sentry SDK (which LightTrace speaks) captures them automatically across every major platform and framework. Common breadcrumbs include:

  • User interactions — clicks, form submissions, page navigations, modal opens.
  • Network events — HTTP requests and responses, with status codes and response times.
  • Console logsconsole.log, console.warn, and console.error calls.
  • Navigation — URL changes, route transitions, back/forward actions.
  • Custom breadcrumbs — anything you manually log to add context specific to your app.

Each breadcrumb carries a timestamp, category, message, level (info/warning/error), and optional data. When an error occurs, the SDK bundles the last 100 (or configurable limit) breadcrumbs along with the stack trace, so the entire timeline is there when your team reviews the issue.

// Automatic breadcrumbs (no code needed)
// Captured by the SDK automatically

// Manual breadcrumb (you write this)
Sentry.addBreadcrumb({
  category: "payment",
  message: "Stripe webhook received",
  level: "info",
  data: { amount: 2999, currency: "usd" },
});

Why error breadcrumbs matter for debugging

Without breadcrumbs, a crash report looks like this:

TypeError: Cannot read properties of undefined (reading 'id') at processCheckout (checkout.js:145)

You see the error and the line. But you don't know:

  • Did the form even submit?
  • Did the API call succeed or fail?
  • Was this a network timeout or a logic error?
  • What state was the UI in when it crashed?

With breadcrumbs, you get the full story:

User clicked "Complete Purchase" → API returned 200 → Response data was parsed → UI state updated → processCheckout() called → TypeError: Cannot read properties of undefined

Now you can trace backward: the API response didn't include the expected id field, your code didn't guard against it, and the crash happened. You've gone from "something broke" to "here's why" — and you know exactly what to test when you deploy the fix.

Breadcrumbs are bounded in memory and storage. They're typically kept for 24–48 hours per issue, so your error tracker stays lean while still providing enough context to reproduce the failure.

People sometimes ask: "I have a stack trace. Why do I need breadcrumbs?" They answer different questions:

  • Stack traceWhere did the code fail? (the call stack at the moment of crash)
  • BreadcrumbsWhat led to the crash? (the events before it)

A stack trace is a snapshot. Breadcrumbs are a timeline. You need both: the trace tells you which line to fix, and the breadcrumbs tell you how to reproduce it so you can test the fix properly. For a deeper look at stack traces, see our guide on reading them like an expert. And when thousands of identical errors arrive, fingerprinting groups them into a single issue — but breadcrumbs help you see which one actually matters.

Capturing breadcrumbs: automatic vs manual

Most breadcrumbs are captured automatically. The Sentry SDK (which LightTrace speaks) hooks into your framework's event system and logs every navigation, network call, and user interaction. You don't have to write a single line of code — it just happens. See how to add error tracking to your app for a quick-start guide.

But for domain-specific context, you'll want to add manual breadcrumbs. In a checkout flow, log order milestones. In a data pipeline, log batch progress. These give your team the semantic context that automatic breadcrumbs can't provide:

// React example: manual breadcrumb in an event handler
function handleCheckout() {
  Sentry.addBreadcrumb({
    category: "checkout",
    message: "User initiated checkout",
    level: "info",
    data: { cartTotal: 12999, itemCount: 3 },
  });

  // Then trigger the payment flow
  processPayment();
}
# Python example: breadcrumb in a task handler
def process_order(order_id):
    Sentry.add_breadcrumb(
        category="order",
        message=f"Starting order processing",
        level="info",
        data={"order_id": order_id}
    )
    # ... do the work

The key is adding breadcrumbs at transitions — when the user does something, when a request completes, when a state changes. Too many breadcrumbs become noise; too few and you miss the story.

Breadcrumbs can contain sensitive data. If you're logging request bodies or user input, make sure your error tracker scrubs PII (passwords, tokens, credit card numbers) before they're stored. Most SDKs do this automatically, but verify your configuration.

Using breadcrumbs to reproduce production errors

When you get a production error with breadcrumbs, the debugging workflow becomes much faster:

  1. Read the trail. Start at the oldest breadcrumb and work forward. What did the user do first? What happened next?
  2. Spot the pivot. Look for where things went wrong — a failed API call, a network timeout, an unexpected console error.
  3. Reproduce locally. Now that you understand the sequence, you can replay it in your local environment or staging.
  4. Test the fix. Deploy a fix and watch for the same breadcrumb sequence with no crash.

This is why breadcrumbs cut mean-time-to-resolution so dramatically. You're not guessing about edge cases; you're following the exact path the user took.

Best practices for breadcrumbs

Be intentional. Don't log every keystroke. Log transitions — page navigations, form submissions, API calls, state changes. Aim for 5–20 breadcrumbs per error, not 100. See error tracking best practices for more on structuring your observability.

Include context. When you log a network request, include the status code and response time. When you log a user action, include relevant IDs or amounts. Context makes debugging fast.

Use consistent categories. Create a taxonomy for your app — auth, checkout, api, user-action, data-fetch. Your team will learn to scan breadcrumbs faster.

Scrub sensitive data. If you're logging request bodies or user input, ensure your error tracker's scrubbing is enabled. The SDK will redact PII automatically in most cases, but review your config.

Breadcrumbs aren't just for browser errors. Every SDK — Node.js, Python, Java, React Native, iOS, Android — captures them. In a distributed system, breadcrumbs from different services tell you the end-to-end story of a failure. One service logs "API call to payment processor," another logs "webhook received," another logs the crash. Together, they're the breadcrumb trail across your entire system.

Start tracking errors in minutes

Get breadcrumbs automatically with the Sentry SDK pointing at LightTrace, so every production error comes with the full timeline of events leading up to it.

Breadcrumbs turn error debugging from guesswork into deduction. The next time you get a cryptic stack trace, look at the trail before it — you'll often see the exact moment things went wrong, and you'll know exactly how to fix it.

Fix your next production error faster

Point any Sentry SDK at LightTrace — free up to 5,000 events/month.