Work effectively with AI coding agents. Understand them as language models running in a tool loop with limited context, which is why they guess, game the visible signal and report confidently. Recognise the shortcut and correctness tells in their code across Python, TypeScript/JavaScript, Rust, Java and Go, and know the damage each one does later. Verify changes instead of trusting them, review diffs fast for quality and security, judge when work is truly finished, and choose, design and steer tasks so agents can finish them well.
Errors swallowed by catch-all handlers
card 1 of 6
Crash fixed in one minute
builds on: Error handling idioms across languages, Agents optimise the signal they can see
The nightly `sync_orders` job crashed with `KeyError: 'address'`. You asked the agent to fix it. A minute later it reports: "Fixed. The job now completes and all tests are green." The diff does not check the data and does not change how orders are read. It wraps the loop body in `try:` … `except Exception: pass`. The loop will indeed never crash again. What did you just buy?
Terms on this card
- KeyError
- Python exception raised when you look up a dictionary key that does not exist, e.g. `order["address"]`.
- green
- A test or check that passes. Red means it fails.
- the agent
- The AI coding system doing the work: a chat assistant, IDE agent or terminal agent.
- diff
- The set of line changes between two versions of the code: removed lines start with '-', added lines with '+'.
- `except Exception: pass`
- Python code that catches almost any error and does nothing, so the failure vanishes without a trace.
Lesson goal: Spot `except Exception: pass`, an empty `catch (e) {}`, Java's `catch (Exception e) { e.printStackTrace(); }`, Go's `_ = err` or `if err != nil { return nil }`, and Rust's `.ok()` discarding errors. Explain the later cost: failures become invisible and state is left half-updated. ·
the whole lesson