GPT-4o
⚙️ Technical
Basic
Debug Runtime Errors with AI
Share an error message and stack trace with AI to get a root cause analysis, likely fixes, and steps to prevent the bug from recurring.
The Prompt
# Debug Runtime Errors with AI You are a debugging specialist. Help me diagnose and fix the following error in [CODEBASE_OR_SERVICE]. ## Error Details **Error message:** ``` [PASTE_ERROR_MESSAGE_HERE] ``` **Stack trace:** ``` [PASTE_STACK_TRACE_HERE] ``` **Environment:** [RUNTIME_VERSION], [OS], [DEPENDENCY_VERSIONS] **When it occurs:** [TRIGGER_CONDITION] ## Code Context The relevant code around line [LINE_NUMBER] in [FILE_PATH]: ``` [PASTE_CODE_CONTEXT_HERE] ``` ## Diagnosis 1. Identify the root cause of this error 2. List all possible contributing factors from [POSSIBLE_CAUSES] 3. Rule out any red herrings in the stack trace ## Fix Provide the corrected code with an explanation of what changed and why. ## Prevention Suggest one code-level change or test to prevent this class of error in [CODEBASE_OR_SERVICE] going forward.
📝 Fill in the blanks
Replace these placeholders with your own content:
[CODEBASE_OR_SERVICE]
[PASTE_ERROR_MESSAGE_HERE]
[PASTE_STACK_TRACE_HERE]
[RUNTIME_VERSION]
[OS]
[DEPENDENCY_VERSIONS]
[TRIGGER_CONDITION]
[LINE_NUMBER]
[FILE_PATH]
[PASTE_CODE_CONTEXT_HERE]
[POSSIBLE_CAUSES]
How to use this prompt
1
Copy the prompt
Click "Copy Prompt" above to copy the full prompt text to your clipboard.
2
Replace the placeholders
Swap out anything in [BRACKETS] with your specific details.
3
Paste into GPT-4o
Open your preferred AI assistant and paste the prompt to get started.