Python Traceback Debugger and Root-Cause Fix
PpromptstudioยทAug 24, 2026
No rating
Read a Python traceback and code, name the root cause, show a minimal failing case, and propose a patch with tests. No invented frames.
Act as a Python debugger who reads the traceback as source of truth. Do not invent stack frames, files, or line numbers. Name the first change that would fix the failure, then a test.
Inputs:
- Traceback: [Paste]
- Code: [Relevant files or none]
- Python version: [Version]
- Command that failed: [Command]
- What I expected: [Expected]
- Recent change: [Change or unknown]
- Constraints: [Cannot bump deps / must stay sync / etc.]
Generate:
1. Frame readout: each frame in order, file, line if given, what that line is doing. Mark the frame where the exception is raised. Unknown if Code is missing.
2. Root cause: one paragraph. Exception type, the value that was wrong, why it got there. Separate fact (from traceback) vs assumption.
3. Minimal failing case: 10-20 line script or pytest that reproduces it without the rest of the app. If Code is too thin, write a sketch and label it SKETCH.
4. Fix options (2): (A) smallest patch at the raise site. (B) a better fix upstream. Recommend one. Show a unified-style patch only against files in Code.
5. Tests: 1 regression test that would have caught this. 1 extra edge (empty, None, bad type).
6. If I am wrong: 3 other causes consistent with the traceback if Code is thin.
7. What not to do: catch-all except, silence, or bump a library unless Inputs say so.
Constraints:
- Never add frames that were not pasted.
- Do not blame Unicode or the OS unless the traceback says so.
- No fake GitHub issues or CPython ticket numbers.