doc/user/gitlab_duo/prompt_examples/debug_failing_code.md
Follow these guidelines when you have code that isn't working as expected or tests that are failing.
Quickly identify the root cause of bugs or test failures and implement effective fixes without spending hours debugging manually.
Analyze errors, identify causes, and implement fixes by using GitLab Duo Chat.
Copy the error message and relevant code. Then ask GitLab Duo Chat to explain the error.
Explain what's causing this error and help me fix it:
Error: [paste_error_message]
Context: [brief_description_of_what_you_were_trying_to_do]
Here's the relevant code:
[paste_problematic_code]
Expected outcome: Clear explanation of the error cause and specific fix recommendations.
Ask Chat to provide the corrected code.
Based on your analysis, please provide the corrected version of this code:
[paste_original_code]
Make sure the fix addresses [specific_error] and follows [language/framework] best practices.
Expected outcome: Working code that fixes the identified issue.
Ask for guidance on how to avoid similar issues.
How can I prevent this type of error in the future?
What are the warning signs to watch for with [error_type] in [language/framework]?
Include any best practices or common patterns I should follow.
Expected outcome: Preventive guidance and best practices to avoid similar bugs.
Ensure that: