惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
腾讯CDC
D
Docker
G
Google Developers Blog
D
DataBreaches.Net
雷峰网
雷峰网
Blog — PlanetScale
Blog — PlanetScale
S
SegmentFault 最新的问题
The Cloudflare Blog
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
量子位
美团技术团队
aimingoo的专栏
aimingoo的专栏
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Engineering at Meta
Engineering at Meta
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How to Use AI to Debug a Stack Trace (Step-by-Step)
The AI Leverage Weekly · 2026-06-24 · via DEV Community

The AI Leverage Weekly

How to Use AI to Debug a Stack Trace (Step-by-Step)

You've got a wall of red text, a stack trace you don't fully recognize, and no obvious starting point. AI can turn that trace into a clear diagnosis and a fix — in under two minutes. Here's exactly how to do it.


Why Raw Stack Traces Are Hard to Parse Alone

Stack traces are dense. They mix your code with framework internals, third-party library frames, and sometimes async noise that obscures the actual origin of the error. The mental overhead of filtering signal from noise is where most debugging time gets wasted. AI is surprisingly good at this — not because it "knows" your system, but because it can pattern-match against thousands of similar traces and explain each layer in plain language.


Step 1: Copy the Full Stack Trace — Don't Trim It

Resist the urge to paste only the top three lines. The root cause is often buried lower in the trace. Copy everything, including the error type, message, and every frame.


Step 2: Use This Prompt Template

Open your AI assistant (ChatGPT, Claude, Gemini — any capable model works) and paste this:

You are a senior engineer helping me debug a runtime error.

Here is the full stack trace:
---
[PASTE YOUR FULL STACK TRACE HERE]
---

Please do the following:
1. Identify the root cause of the error in plain English.
2. Pinpoint the exact line or frame where the error originates (not just where it surfaces).
3. Explain why this error occurs — what condition triggered it.
4. Suggest a concrete fix with a code example.
5. List any other places in a typical codebase where this same pattern might cause the same error.

That fifth point is the one most developers skip — and it's where you stop patching and start preventing.


Step 3: Add Context to Get a Sharper Answer

After the initial response, follow up with:

Here is the function where the error originates. Does this change your diagnosis?

[PASTE THE RELEVANT FUNCTION OR METHOD]

This two-pass approach — trace first, code second — gives the model enough context to go from "here's what's probably wrong" to "here's exactly what's wrong."


Step 4: Ask for a Reproduction Case

Write a minimal code snippet that would reproduce this error so I can verify the fix before applying it.

This forces the model to commit to a specific understanding of the bug. If the reproduction case doesn't match what you're seeing, you've caught a hallucination before it costs you time.


Step 5: Validate the Fix, Then Ask for a Test

Here is the fix I applied: [PASTE FIX]. Now write a unit test that would have caught this error before it reached production.

You've just turned a debugging session into a regression test — automatically.


What This Workflow Actually Gets You

  • A plain-English explanation you can share with a teammate or put in a PR description
  • A fix you can verify before applying
  • A unit test that closes the loop
  • A checklist of similar patterns to audit in the rest of the codebase

This entire flow takes five minutes once you have the prompt structure memorized.


I break down one workflow like this every week in The AI Leverage Weekly — practical AI techniques for engineers, no fluff, free. Subscribe: https://theaileverageweekly.beehiiv.com/subscribe?utm_source=devto&utm_medium=article&utm_campaign=medium_w7