When I paste a raw stack trace, models tend to fixate on the deepest frame and suggest a fix right there, even when the real cause is three frames up where a bad value was created. The topmost error is a symptom, not always the origin.
I now make it walk the trace outward: separate the throwing frame from the originating frame, trace where the offending value came from, and produce a ranked list of candidate causes with a confidence and a cheap check for each, rather than one confident guess. It's especially good for the "NoneType has no attribute" class of errors where the null was born far from where it exploded.
Sharing the current version. How do you feed it just enough surrounding code without pasting the whole repo?
Turn this stack trace into a ranked root-cause analysis. The top frame is a SYMPTOM; find the ORIGIN.
Given:
- Stack trace: {PASTE_TRACE}
- The error and message: {ERROR}
- Any code from frames I include: {PASTE}
Do this:
1. Identify the throwing frame (where it blew up) and separate it from the likely originating frame (where the bad state was created). For a null/None/undefined error, trace backward: where could this value have become bad, and where should it have been validated?
2. Produce a RANKED list of candidate root causes (most to least likely). For each: one-line hypothesis, the confidence (high/med/low), the single cheapest check to confirm it (a value to log, a line to inspect), and the targeted fix IF confirmed.
3. State what additional code you'd need to see to raise confidence, naming the specific function/file - do not ask for the whole repo.
4. Do not propose a fix for anything you rated below 'high' without confirming first.
Rules: no shotgun fixes, no 'try adding a null check everywhere'. The output is a diagnosis to verify, not edits to apply blind.