Read the Error First
Kitty's balances page crashes for one flat. The error fills the screen, and the reflex is to copy all of it into the assistant without reading a word. Sometimes that works. But thirty seconds of reading first makes your prompt sharper, teaches you something, and, most importantly, lets you tell whether the assistant's fix addresses the real cause.
The rule
Read the error yourself first: what failed, where, and your guess why.
In Python, a crash prints a traceback:
Traceback (most recent call last):
File "kitty/app.py", line 42, in balances_page
rows = compute_balances(db, flat_id)
File "kitty/balances.py", line 17, in compute_balances
share = total // len(members)
~~~~~~^^~~~~~~~~~~~~~
ZeroDivisionError: division by zero(Recent Python versions underline the failing part of a line with ~ and ^, as here; older versions leave the underline out, and message wording can differ slightly between versions.) It reads like this:
- The last line says what failed: the type of error and a message. Here, something was divided by zero.
- The lines above show the chain of calls, with the most recent call last. Each entry names a file, a line number and a function, then shows that line of code.
- The lowest entry in your own files is usually where to look. If a traceback runs on into a library, the mistake is still more likely in how your code called it.
Then comes the step that makes it yours: a guess. At line 17, len(members) must be 0. When would a flat have no members? Flat 7's flatmates all moved out last month.