Not every bug throws a red wall of text. Often the app runs fine and just does the wrong thing: the total is off, the wrong name shows, a click does nothing. There is no crash and no trace to paste, so you are stuck describing a symptom your agent cannot see. This chapter gets you a way to make that invisible bug visible.
7.2.1Not every bug crashes
A crash is loud. As the stack-trace chapter covered, it prints a report that points straight at the file and line where the code gave up. You have somewhere to look.
A silent bug gives you none of that. The code runs all the way to the end and produces a wrong result, so nothing errors and nothing points at the spot. That absence is exactly what makes it harder: there is no red text to follow, only a wrong number on the screen.
7.2.2Look in the console and the network tab
The evidence is usually already there, in the parts of the browser you have not opened yet. Right-click the page, choose Inspect, and three places tell you most of what you need.
| Place | What it shows |
|---|---|
| Console | Errors and warnings the page printed |
| Network tab | A request that failed or returned wrong data |
| The screen | The actual wrong value, next to what it should be |
Open all three before you touch the code. A warning in the console or a failed request in the network tab often names the problem outright.
7.2.3Add a log to see what's happening
When nothing on the surface explains it, the core move is to add a log: a line that prints a value so you can watch what the code actually holds. You ask your agent to drop one at the suspect spot, run it, and read the result.
Here is what one looks like, in JavaScript and in Python:
Run it, and the real value prints where you can see it. If you expected 90 and it prints 100, you have found the exact point where reality diverges from what you assumed.
7.2.4Hand the agent the observation, not the symptom
"It's broken" or "the total is wrong" gives your agent nothing but your guess. It will guess back, and you both circle. As the chapter on agent loops covered, a loop only breaks when you feed in something concrete.
The something is what you just captured: the failed request, the console warning, the value your log printed versus the value you expected. Hand that over and the agent stops guessing and starts tracing.
Do this now: open the console and network tab on the page that misbehaves, paste the prompt with what you see, and add the one log line your agent gives you to turn the invisible bug into a value you can read.