# Breadcrumbs, tags & context A stack trace tells you where it broke. These three tools tell you why — what state the app was in, and the trail of steps that led there. They turn "it crashed" into "here's exactly what happened." Source: https://cross-deck.com/university/breadcrumbs-tags-context/ Verified Crossdeck University lesson — prose plus real, runnable code. ## Three tools, three questions The difference between an error you fix in five minutes and one you stare at for an hour is the context around it. Crossdeck gives you three tools, each answering a different question: ## Set the scope; the next error inherits it You set these before an error happens; whatever's in scope at capture time travels with it: Copy // a label to filter and group by Crossdeck.setTag("flow", "checkout"); // a named block of state, captured if an error fires Crossdeck.setContext("cart", { items: 3, total: 49.0, currency: "USD" }); // a step on the trail — the last 50 ride along on the next error Crossdeck.addBreadcrumb({ category: "ui", message: "clicked Pay" }); And when you need to keep something out of the payload — a token in a URL, an email in a message — register a beforeSend hook that scrubs or rewrites each error on its way out: ```web // a label to filter and group by Crossdeck.setTag("flow", "checkout"); // a named block of state, captured if an error fires Crossdeck.setContext("cart", { items: 3, total: 49.0, currency: "USD" }); // a step on the trail — the last 50 ride along on the next error Crossdeck.addBreadcrumb({ category: "ui", message: "clicked Pay" }); ``` ```web Crossdeck.setErrorBeforeSend((error) => { // mutate to scrub, or return null to drop the event entirely delete error.context?.cart; return error; }); ``` ## Ambient scope, snapshotted at capture Tags, context, and breadcrumbs are ambient — you set them as your app runs, and they sit in scope. When an error fires (caught or uncaught), Crossdeck snapshots whatever's there and attaches it. Breadcrumbs are a rolling buffer of the most recent 50, so the trail is always "the last 50 things that happened," without you managing the list. The beforeSend hook is your last gate before anything leaves the device: it receives the fully-assembled error, and you can mutate it to scrub a field or return null to drop the event entirely. Combined with last lesson's identity attribution, this is what makes a Crossdeck error reproducible — you know who hit it, what they'd done, and the exact state they were in — while keeping anything sensitive off the wire. ## An error you can actually reproduce Open any issue and the right-hand detail now reads like a report: the tags you can pivot on, the context block with the state at crash time, and the breadcrumb trail of the user's last moves — everything you need to reproduce it without a single "can you tell me the steps?" email. tags · context · trail Tagged flow: checkout, cart state attached, and the breadcrumb trail ending in "clicked Pay" — reproducible at a glance.