Debug code by pasting the error and the snippet

code & data

// what it does

Give ChatGPT the failing code, the full error or traceback, and what you expected to happen. The error text is the highest-signal input — it usually names the file, line, and exception — so include it verbatim rather than paraphrasing. Ask for the root cause and the fix, not just a patched snippet, so you learn what broke.

// prompt

> This function throws the error below. Explain the root cause, then give the corrected code. Code: [paste code] Error: [paste traceback]

// gotcha

Without the exact error and enough surrounding code, ChatGPT guesses and may "fix" something that was never wrong. Paste the real traceback and the relevant function; in Canvas, the Fix bugs shortcut and in-browser Python execution let it see the actual output.

// resources