Coding agents debug phantom failures because they never verify the error exists
Your coding agent hits a wall. The tests are failing, but they were passing yesterday. It spends 20 minutes debugging phantom failures, rewriting working code, and chasing ghosts.
The problem? It never checked if the tests actually run.
Here's what happened: I gave Claude a Python service to debug. "Fix the failing tests," I said. It immediately started rewriting the authentication logic, refactoring database calls, and adding error handling.
Twenty minutes later, I ran the tests manually:
$ pytest ======== FAILURES ======== E ModuleNotFoundError: No module named 'pytest-asyncio'
The tests weren't failing because of logic errors. They weren't running at all. Missing dependency.
Claude had been debugging based on stale test output from my terminal history. It saw "FAILED" and assumed the code was broken. Never verified that assumption.
Now I give every coding agent this verification ritual:
Before debugging any failing tests: 1. Run the test command and verify it executes 2. Check dependencies are installed 3. Confirm the test file exists and is valid Python 4. Only then analyze the actual failure
This catches 80% of "test failures" before they waste your agent's time:
- Missing dependencies — pip install requirements.txt
- Wrong directory — cd to project root first
- Syntax errors in test files — python -m py_compile test_*.py
- Environment variables — export TEST_DATABASE_URL=...
The pattern works for any development task. Don't debug the symptom. Verify the symptom exists first.
Pro tip: Add "verify the error reproduces" as step 1 in your agent's debugging instructions. It'll save you hours of phantom debugging sessions.
Your agent is smart enough to fix complex bugs. It's not smart enough to question its assumptions. That's your job.