Error messages lie to agents. Output parsing tells the truth.
I watched our coding agent spend 40 minutes "fixing" a database connection that was already working perfectly. The problem? It trusted the error message instead of checking the actual state.
Here's what happened: Our agent was deploying a new feature when it hit this error:
ConnectionError: Unable to connect to database at localhost:5432 Could not establish connection after 3 attempts
The agent immediately started "debugging" — restarting services, checking configs, even rebuilding the entire Docker environment. Meanwhile, I could see the database was running fine and accepting connections from other services.
The real issue? A typo in the connection string that only affected this one service. But the agent never verified whether the database was actually down before trying to "fix" it.
Now we use verification-first debugging. Before our agent tries to fix anything, it runs reality checks:
# Before fixing "database connection issues" psql -h localhost -p 5432 -U user -c "SELECT 1;" # Does DB respond? docker ps | grep postgres # Is container running? netstat -tlnp | grep :5432 # Is port actually open? # Before fixing "service crashes" curl -I http://localhost:8080/health # Does service respond? ps aux | grep service_name # Is process actually running? tail -n 10 /var/log/service.log # What does it think happened?
The pattern is simple: verify the symptom before treating the disease. Error messages lie. Logs lie. Exit codes lie. But ps aux and curl don't.
Pro tip: Build verification commands into your agent's debugging toolkit. Most "mysterious failures" aren't mysterious — they're misdiagnosed.
We added a verification step to every debugging workflow. Now when something "breaks," our agent first proves the thing is actually broken before trying to fix it.
The result? Debug time dropped 70%. Turns out most of our "critical failures" were either already fixed, never broken, or completely different problems than the error messages suggested.
Your coding agent needs the same discipline. Teach it to verify first, debug second. Error messages are suggestions, not facts.