Build with AI: From Zero to Your First App · Module 7: Debugging and testing
Write a Bug Report With Logs and Last Change
Good reports get one-round answers; bad ones get interrogations. This lesson writes the report shape that aims any helper at the fault immediately.
9 min reading
Objectives
- Write a bug report with logs and the last change
- Attach the console message with file and line
- State the snapshot the report can roll back to
- Explain what makes a report answerable in one round
Why this matters
Helpers (human or AI) answer the report they receive. "It broke, please help" buys questions; a report with reproduction, message, file, line and last change buys an answer. The cost difference is minutes versus days across a course of thirty bugs. Reporting is a multiplier on every later debugging skill.
Concepts
The six-line report. Reproduction (expected/actual/steps from M07L25). Console message verbatim with file and line (M03L12). Last change before it broke (the snapshot reason line doubles as this). Snapshot available (name it, so the helper knows rollback exists). What you already tried (one line each, so advice does not repeat). Question (one sentence: "why does save silently drop entries when storage is full?").
Logs, not summaries. Paste the exact message, not "some null error". Exact text is searchable; summaries are not. Include the file reference the console shows; it is the address. Trim surrounding noise but never the message itself.
Answerable in one round means the helper needs no follow-up to start: scene, address, history, safety net, attempts, question. Anything missing becomes a round trip. Write the report, then re-read asking "what would I ask next?" and fill that gap before sending.
Worked example
Bad: "My list is broken, orders disappear. Help!" Good: "Expected: entries persist across reload. Actual: entries dropped silently. Steps: fill storage with old data, submit, reload. Console: no error (silent drop) at app.js save(). Last change: added delete button. Snapshot: folder-2026-10-06-before- delete available. Tried: cleared one entry, still drops. Question: does save fail silently when storage is full, and how should the page answer?" One round to the quota-check fix.
Expected result: your hardest current bug reported in six lines with logs and snapshot named.
The common wrong move
Hiding attempts ("I tried nothing, fix it for me") or hiding the last change ("it just broke"). Helpers re-suggest tried things and miss the prime suspect. History is evidence; include all of it.
Lab and next step
Lab A20 writes six-line reports for two cage cases. Next, lesson 27 runs the test routine: normal, edge and invalid inputs plus old features.
Quick check
An optional 4-question self-check. Answers never leave your device, are not stored, and never count toward any assessment.
Lesson feedback
No published feedback yet.
Log in and complete the lesson to leave feedback.
Exercise
Write the six-line report for your hardest current bug: reproduction, verbatim message with file/line, last change, snapshot, attempts, one question.
Pass criteria
Six lines present with verbatim message and file/line; last change and snapshot named; attempts listed; single question stated.