← Back to Mend
Live demo · Real pipeline run

Watch Mend fix a real production bug.

A null-dereference TypeError hit production 312 times across 47 users. Here's the complete Mend pipeline — from Sentry alert to merged fix — running in 17 seconds.

1
Sentry T+0s · 2026-06-10 04:42:01 UTC
Exception caught in production
Sentry fires a webhook to Mend the moment this error crosses the alert threshold.
TypeError
Cannot read properties of null (reading 'toLowerCase')
project mend-demo/buggy-checkout env production events 312 users affected 47
Stack trace
src/checkout.js:47 in processCheckout
src/checkout.js:23 in validateUser
src/routes/order.js:118 in POST /api/orders
node_modules/express/lib/router/layer.js:95 in Layer.handle [as handle_request]
2
AI Analysis T+2s · claude-sonnet-4
Root cause identified
Mend sends the stack trace to the LLM with the file context, receives a structured JSON analysis + full file patch.
model claude-sonnet-4 latency 8400ms file src/checkout.js
The root cause is a missing null guard in `validateUser()` at `src/checkout.js:23`. When `db.getUserByEmail()` returns `null` for an unrecognised guest email, the code immediately dereferences `user.email.toLowerCase()` without checking if `user` exists — throwing a TypeError in production. The fix is a one-line guard that returns early with a 404 when the lookup yields null.
3
Pull Request T+10s · github.com
PR opened with the fix
Mend commits the patched file to a new branch and opens a PR — real commit, real author, real CI run. Auto-merge is off so you can inspect it.
src/checkout.js
+4 −1
async function validateUser(email) {
const user = await db.getUserByEmail(email);
const normalised = user.email.toLowerCase();
+
if (!user) return null; // guard: guest email not found
+
const normalised = user.email.toLowerCase();
return validateEmailDomain(normalised);
}
branch mend/typeerror-validateuser-1749527321 base main author mend-bot
All checks passing
Resolved T+17s total
Bug contained, fix ready for review
🩹
The fix is live on GitHub — one null guard, one commit, zero human involvement. Auto-merge is intentionally off here so you can inspect the diff yourself. In production, Mend would merge after CI passes.
trigger → analysis: 2s analysis → commit: 8s commit → PR: 7s total: 17s

Connect your stack. Heal your first bug today.

7-day free trial. No credit card required. Takes 2 minutes to set up.

Start your 7-day free trial → Sentry + GitHub · Works out of the box