Real Use Case

Use Case #16: Deep Bug Investigation

How Claude traced a bug through multiple layers without giving up.

W

William Welsh

Author

Jan 5, 2026
7 min read

Use Case #16: Deep Bug Investigation

"It works most of the time."

The worst kind of bug.

The Symptom

User clicks "Generate Report." Usually works. Sometimes returns empty. No error. No pattern I could identify.

The Investigation

I asked Claude to investigate systematically. What followed was 43 minutes of methodical debugging.

Minutes 1-5: Reproduce - Claude tried the feature 10 times. Failed 3 times. Confirmed: intermittent, roughly 30% failure rate.

Minutes 6-15: Trace the Flow - Report generation touched 12 files: UI component, API route, service layer, database queries, PDF generator, email sender. Claude mapped the entire flow.

Minutes 16-25: Instrument - Added logging at each step. Ran 10 more tests. Found: failures happened when step 3 (data fetch) and step 4 (template load) completed in different order.

Minutes 26-35: Root Cause - The code assumed template loaded before data. Both were async. Usually template was faster. But under load, data sometimes won. When data arrived first, it tried to render with undefined template. Silent failure.

Minutes 36-40: Fix - Added proper await ordering. Both async calls now complete before rendering starts.

Minutes 41-43: Verify - Ran 20 tests. Zero failures.

What Made This Work

No giving up. Claude didn't stop at "it's intermittent." It kept digging.

Systematic approach. Map the flow, instrument it, find the pattern, fix the root cause.

Statistical validation. Not "it seems to work" but "20/20 successful after fix."

The Lesson

Intermittent bugs have deterministic causes. The randomness is in the environment (timing, load, order), not the bug itself. Find what varies.


This was in the ContentEngine report generator, January 2026.

W

William Welsh

Building AI-powered systems and sharing what I learn along the way. Founder at Tech Integration Labs.

View Profile
Share this article:

Related Articles

View all →