| name | debugging-strategies |
| description | Systematic debugging: stack trace analysis, log-based diagnosis, bisecting regressions, memory leak detection, and profiling. |
| metadata | {"thinkfleetbot":{"emoji":"🐛","requires":{"anyBins":["git","node","python3"]}}} |
Debugging Strategies
Systematic approaches to finding and fixing bugs.
Stack Trace Analysis
Read the trace bottom-up
The bottom of a stack trace is the most recent call — start there.
NODE_OPTIONS="--stack-trace-limit=50" node app.js
python3 -u -X tracemalloc app.py
Common patterns
- TypeError: Cannot read property of undefined → Check the object one level up in the chain
- ECONNREFUSED → Service isn't running or wrong port
- ENOMEM → Memory exhaustion, check for leaks
- Segfault → Native addon or buffer overflow
Log-Based Debugging
tail -f app.log | grep -E "ERROR|WARN"
grep -n "error" app.log | tail -20
grep "req-abc123" app.log
docker logs --since 5m --follow myapp 2>&1 | grep -i error
kubectl logs -l app=myapp --since=10m | grep -i
kubectl logs -l app=myapp --all-containers --prefix --since=5m