Locate the error
Causes ranked by likelihood, plus how to verify each one
I hit this error on [stack and version]. [What I have already tried]. Please: 1) list the causes from most to least likely; 2) for each, give a way to verify it (one command, or a minimal reproduction); 3) do not repeat anything I have already tried; 4) if there is not enough information to decide, tell me exactly what to add. ``` [paste the error and stack trace] ```
How to use
Paste the error and the stack first, before the code — the code pulls the guess toward whatever it can see.
Good for
- The error reproduces reliably and the stack trace is complete, but you do not know the framework or library layer it fails in.
- Two or three fixes have already failed and you need help ruling directions out, not more guesses.
Not for
- The error is intermittent in production and the logs carry no request id or input parameters: add logging first, or you will only get a list of guesses.
- It was actually caused by the lines you just changed: git diff or git bisect beats asking a model.
Example
Input
TypeError: Cannot read properties of undefined (reading 'map')
at OrderList (src/components/OrderList.tsx:42:31)
at renderWithHooks (react-dom.development.js:14985:18)
Next.js 13.4 / SWR 2.2 / Node 18
Already tried: adding ?., clearing the .next cache, reinstalling node_modulesWhat you get
Rank 'the component calls data.map while the API is still loading or has errored, so data is undefined' first; second, SWR has no fallbackData and the key is reused across route changes; third, the endpoint itself returns empty. Give each one a verification step (log data before line 42, mock a 500 and see if it still crashes) and skip the `?.` already tried.
Common mistakes
- Pasting only the last error line without the stack or versions: it can only guess from the most popular framework version.
- Omitting what you already tried, so it walks the same ruled-out paths again and the round is wasted.
Try tweaking it like this
- Add 'first give only the three most likely causes and the command that confirms each, no fix code yet' to narrow the search before editing.
- Paste the actual `package.json` or `pip freeze` text instead of a version summary; most version-related hallucination disappears.