Which tool to choose
You don't need to install anything: the AI chat you already use in the browser reads and fixes code. The difference is in the slant of the answer.
- If you want to understand what went wrong and learn something while you fix it, choose an assistant that explains its reasoning line by line. It's the right option when the code isn't yours and you want to touch it without doing damage.
- If you just want the corrected piece quickly, any general-purpose assistant will do: you ask it for the fixed version and paste it.
For someone who doesn't program, the explanation is worth more than the speed: code that restarts but that you don't understand will break again, and the second time you'll be back to square one. Start from the tool that explains things to you.
How to do it
From a computer or a phone the path is the same: the chat window is the same.
- Copy all the code of the file that's giving problems, not just the line you suspect. The error often arises three lines higher up than where it blows up.
- Copy the error message in full, including the long, incomprehensible part they call a traceback (the report a program prints when it crashes: it says on which line it tripped). That part looks like noise, but to the AI it's the map of the problem.
- Write in one sentence what you expected: "it was supposed to add two numbers and print them, instead it stops."
- Paste the three pieces into a single message. The operational syntax:
I don't program. I have this code and this error.
Explain in simple words what's wrong and why,
then give me the complete corrected code to copy in place of mine.
Add a comment next to the line you changed.
CODE:
[paste all the code here]
ERROR (copied in full):
[paste the complete message here]
WHAT IT WAS SUPPOSED TO DO:
[a sentence of your own]
- Feedback: the AI returns an explanation and a block of code. Copy that block, replace your file with it in full (don't paste just one line: you risk breaking the alignment), save, and try again.
- If it restarts but does the wrong thing, it's not over: paste the code again and describe the new behavior. Fixing is a dialogue, rarely a single shot.
A concrete example
Marta runs a small shop and found online a Python script that bulk-renames product photos. She launches it and gets a wall of red text ending in FileNotFoundError. She doesn't know what it means.
She pastes the code and the error into the AI with the prompt above. The reply: the script looks for the photos in a folder called images, but her folder is called Pictures, and the computer distinguishes capitals and accents. The AI returns the script with the corrected line and a comment next to it: # here I put the exact name of your folder.
# before: folder = "images"
folder = "Pictures" # here I put the exact name of your folder
Marta replaces it, relaunches, the 80 photos get renamed. Total time: four minutes, zero lines written by her.
When it does NOT work (and how to fix it)
If the AI gives you a correction that makes things worse
This happens when you showed it too little. Go back: paste the complete file, not a fragment, and add the updated error message. If there's a point where the code worked, say so: "it worked until yesterday, I only changed this part."
If the AI invents a function or a name that doesn't exist
Sometimes it proposes a command that sounds right but the program rejects with a new error. Re-paste that new error and write: "this command gives an error, does it really exist? propose an alternative that's guaranteed to work." The concrete error puts it back on track better than any reproach.
If the code is long and the AI seems lost
Beyond a certain length the assistant struggles to keep it all in mind. Isolate the piece that's giving problems: usually the traceback names a file and a line number. Paste that function (the block of lines starting with def) instead of the whole program, and specify it's only one part.
If you don't even have an error message, "it does nothing"
Then the problem isn't a crash but wrong behavior. Describe to the AI what you press, what appears, and what you wanted: "I click enter, nothing happens, I was supposed to see the total." Ask it to add lines to the code that print the intermediate steps, so together you see where the reasoning breaks off.
A tip from someone who actually uses it
Always ask for the comment next to the changed line. That # here I corrected... isn't for the AI, it's for you: it's the only way to find the change again in a month, when you'll have forgotten everything and something breaks again. Corrected, silent code is code that will betray you at the next opportunity.
Frequently asked questions
Do I have to tell the AI what language the code is written in?
You don't need to: it recognizes it on its own from the form. If you do know it (Python, JavaScript, an Excel sheet with formulas) writing it helps remove any doubt, but it's not a required step. Just paste and that's it.
Is it dangerous to paste my code into a chat?
It depends on what it contains. The code itself is usually harmless, but if inside it there are passwords, access keys, or customer data, those should be removed or replaced with the word PASSWORD before pasting. The rule is that of any document: don't give an external service what you wouldn't want getting out.
Can I trust the correction without understanding it?
For a script that runs on your computer and touches only your own things, test it: if it works, it works. For code that handles money, other people's data, or a public website, no. There, the correction that "looks right" is the most insidious, because it goes wrong only in one case out of a hundred. When the stakes are high, a person who programs has to look at it.
If I don't know how to program, don't I risk piling up code I don't control?
It's the right fear, and the answer isn't to stop but to change your habit. Every time the AI corrects, ask it also to "explain this line as if I were ten years old." You won't become a programmer, but after ten corrections you'll recognize the faults that keep coming back the same, and you'll get out of them sooner. The AI that corrects without explaining makes you dependent; the one that explains makes you a little more free each time.