Go from never having used a coding agent to working productively and safely with one. The learner should understand what an agent is and how it differs from a chat assistant. They should choose a tool, set up a protected first project, describe tasks the agent can do well, and follow and verify its work. They should recover from bad changes, manage context, and plan bigger changes. They should also use tests as the definition of done and run everyday workflows (bug fixes, features, writing tests, codebase exploration, scripts, small tools, refactors). Throughout, they should keep secrets and systems safe and keep their own understanding growing instead of outsourcing it.
Reading an error message and stack trace
card 4 of 6
Reading the KeyError trace
builds on: Command output and exit codes
Type: `KeyError`, meaning code asked a dictionary for a key it doesn't have. Message: `'price'` is the missing key. It broke in `src/prices.py` line 5, inside `add_prices`, which was called from `report.py` line 8. So some row has no `"price"` entry.
When you ask for help, don't write "report crashes". Don't retype "key error" either. Paste the command and the full trace verbatim, and say what you expected.
Terms on this card
- KeyError
- Python error raised when code asks a dictionary for a key that isn't in it.
- dictionary
- A Python collection of named entries (keys) with values, e.g. `{"price": 5}`. Also called a dict.
- verbatim
- Copied exactly, word for word, without retyping or summarising.
- command
- A line of text that tells the computer to run a program, typed in a terminal, for example `python src/cart.py`.
- src
- Short for "source": a common folder name for a project's main code files.
Lesson goal: Find the error type, the message, and the file and line where a failure happened in a stack trace. Identify which part to paste to an agent as evidence. ·
the whole lesson