ChatGPT prompt to fix a bug

Coding and ITFree prompt

Paste the code, the error message and what you expected: the AI looks for the cause, suggests a minimal fix and explains how to check that it works.

Customise the prompt

Your prompt

🔒 The fields stay in your browser. The prompt is only sent to the AI service you choose to open.

How do I fix a bug with ChatGPT?

Give the AI the language, what the code should do, the full error message and the relevant code, then ask for the likely causes, a minimal commented fix and a way to check it. The free Lunyce prompt follows this method; always test the fix before using it.

How to use it

  1. Describe what the code should do and paste the exact error message.
  2. Paste the relevant part of the code, then copy or open the prompt in your AI.
  3. Apply the suggested fix, test it, and send the new error message if the problem persists.

Tips for better results

  • Copy the whole error message, including the line number: it is the most useful clue.
  • Never paste API keys, passwords or customer data into an online AI.
  • Make a copy of your file before applying a fix.
Can I trust code fixed by ChatGPT?

It is a good starting point, but the AI can be wrong or fix the symptom rather than the cause. Always test the fix, ideally with an automated test, before putting it into production.