Template — fix a bug
what you did, what you expected, what you got
What it is
A fix request differs from a new-function request in one way: here you are not giving an assignment but evidence. The AI did not watch it break, and all it has is your description.
From which the main rule follows: do not retell the error in your own words. Hand over what you saw, verbatim, and add what the traceback does not contain — what you did and what you expected.
What it looks like in code
The template
What I did: <the action that led to the error>
What I expected: <the behaviour you consider correct>
What I got: <output, traceback, screenshot — verbatim>
<the whole traceback>
Where to fix: <if you know which layer should handle it>Bad
the bot crashes on weather, fix itThe AI knows neither the city, nor the error, nor the line. It will start rewriting the whole handler, changing things that worked along the way.
Good
What I did: sent the bot /weather Tonsberg
What I expected: the reply "City not found" — the API has no such city
What I got: an exception, the bot did not reply at all
Traceback (most recent call last):
File "handlers/weather.py", line 34, in cmd_weather
await message.answer(format_report(data))
File "handlers/weather.py", line 11, in format_report
temp = data["main"]["temp"]
~~~~^^^^^^^^
KeyError: 'main'
Where to fix: the API error should be caught in fetch_weather,
not in format_report.What to tell the AI
Three questions without which nothing gets fixed
What you did. The reproduction steps. If it doesn't happen every time, say so too: "fails about one time in five" changes the direction of the search completely.
What you expected. Without it the AI cannot tell a bug from intended behaviour. In the example above, that line is what says "City not found" is a normal reply rather than an error.
What you got. Verbatim. The whole traceback, starting at the word
Traceback. How to read one — article 2.12.
Where to fix — optional, but valuable
If you don't say, the AI fixes wherever the traceback pointed. And the crash site and the cause are different places. Line 11 honestly does what it was asked; the guilty line is the one that decided a server reply was the weather.
When there is no traceback
Sometimes nothing crashes, it just works incorrectly. Then the data becomes the evidence:
What I did: /stats for October
What I expected: 142 records, as in the database
What I got: 138
Here is the query I count with: <code>
Here is what the database says: <output of SELECT COUNT(*)>Two numbers that don't match are evidence every bit as good as a traceback.
What to look for
The AI muffles the error instead of handling it. The signs in the diff: a
try/except around the line that failed, .get(key, {}) instead of a check,
a default where there should be an error. It stops crashing and starts lying.
The crash site is fixed, not the cause. If the change only touched the line the traceback pointed at, ask: "where did the wrong data reach this function from?"
Extra things rewritten along the way. A two-line fix should not produce a fifty-line diff. Add to the prompt: "change only what the fix requires".
Fixed but not verified. A diff that looks right does not mean the bug has gone. Reproduce the very case you started with.
Cheat sheet
Three lines: what I did · what I expected · what I got.
Hand over the traceback verbatim and in full.
Say which layer to fix in, or the crash site gets fixed instead.
"Make the error go away" ≠ "fix the cause".
No traceback — two numbers that don't match are the evidence.
After the fix, reproduce the original case.