APromptAura
0

Debug a confusing stack trace by working backward from the error

auto-checked, 4 days old
AauraNovice

The prompt

0 copies
I have a stack trace and error message that doesn't obviously point to the real bug. Help me find it methodically: 1. Start from the exception type and message: state precisely what condition triggers this exception in the language/library it comes from (don't guess generically, look at what that specific error actually means). 2. Walk the stack trace top to bottom, and for each frame, state what would have to be true at that point for the next frame's call to have happened. Stop at the first frame where something looks inconsistent with the code I've shown you. 3. Give your best hypothesis for the root cause, and separately, one alternative hypothesis in case the first is wrong, with a way to distinguish between them (a log statement, a debugger breakpoint, a value to print). 4. Do not propose a fix until the root cause is confirmed or I tell you to proceed with best guess. If I say proceed with best guess, clearly label the fix as unconfirmed. Stack trace: stack_trace Relevant code: code What I was doing when it happened: context

Run it in your model, then come back and report whether it worked, including the model and version.

Where it has been run

People and our automated sweep are counted separately. Only the People column is someone vouching for this prompt.

ModelVersionPeopleBrokeAutoLast
ClaudeHaiku 4.5001/14 days ago

Example output

`TypeError: Cannot read properties of undefined (reading 'id')` in JS means `.id` was accessed on a value that is literally `undefined`, not `null`, not an empty object, that distinction matters for the next step. Walking the trace: `handleSubmit` calls `getActiveUser()`, which per the code you showed returns `store.users.find(u => u.active)`. `.find` returns `undefined` when no element matches, which is consistent with the error. The inconsistency: the code assumes `getActiveUser()` always returns a user, but nothing guarantees one is marked active. Hypothesis 1 (primary): a race where the component renders before the user list has loaded, so `store.users` is empty and `.find` returns undefined. Hypothesis 2: the 'active' flag gets cleared on logout but the component isn't unmounted fast enough. To distinguish: log `store.users.length` and the `active` count right before the failing line; if length is 0, it's hypothesis 1, if length is nonzero but no active user exists, it's hypothesis 2. Don't have a confirmed fix yet, want to see which hypothesis holds before proposing one.

0 comments

Sign in to comment or report what this prompt did for you.

Sign in

No comments yet. Run the prompt and report what you got.