StoicBuilder

HandbookI the LudusStack traces

Ithe Ludus, Read code

Stack traces

1 min readUpdated 28 November

In plain words

A stack trace is the list under an error that shows which function called which, so you can follow the trail back to your own code.

Where you see it

The indented lines starting with "at" under an error in the console or in your Vercel function logs. The top line is where it broke; each line below is the code that called it.

Vercel function logserver
TypeError: Cannot read properties of undefined (reading 'email') at sendReceipt (lib/email.ts:9:31) at createOrder (app/api/orders/route.ts:42:9) at async POST (app/api/orders/route.ts:18:5) at node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:38417
Read down from the top until you reach a file you recognise.

What goes wrong

  1. Blaming the library at the top

    Sometimes the top lines point inside React or Next.js. The bug is usually in the first line that points at one of your own files.

  2. Sharing only the first line

    The first line says what broke, but the same message can come from a dozen places. The lines underneath say which function and which caller, so paste all of it.

  3. Line numbers that don't match your files

    On a live site the code is minified, squeezed into a few compact files, so the trace points at names like index-a1b2c3.js. Reproduce the error in the dev preview, where it points at your real files.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Using the stack trace below, find the first line that points at my own files rather than node_modules. Tell me what that function was doing when it failed, and fix the cause there.

Quick check

Sign in to earn +10 XP for it

A trace starts with three lines in node_modules/react-dom, then one in src/components/Cart.tsx. Where do you look first?

Got a prompt that touches stack traces?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.