When Not to Use AI: Sometimes You Should Just Read the Code
Back to Articles

When Not to Use AI: Sometimes You Should Just Read the Code

November 30, 2026
4 min read

Monday evening, one chat window, five prompts deep. You paste the error. The AI suggests a fix. It does not work. You paste the new error. It suggests the old fix again. Sound familiar? Sometimes the fastest way to fix a bug is still reading the code. Knowing when not to use AI is a skill too, and it is one that many developers are still learning.

AI is a great tool. But when you are going in circles, the answer is simple:

  • Stop.
  • Read the code yourself.
  • Come back with a better question.

Why AI gets stuck in loops

An AI assistant works from what you give it. If the real cause of the bug is not in the context, it cannot see it. It will guess based on the error message and common patterns. When the guess is wrong, you give it a new error, and it guesses again from the same incomplete picture.

A few reasons this happens:

  • Missing context. The bug lives in a file, config or data the AI has not seen.
  • Wrong framing. Your first prompt described a symptom, and every answer since has chased that symptom.
  • Polluted history. After several failed attempts, the chat is full of wrong ideas that keep pulling the answers off course.
  • Unusual code. Your system does something non-standard, and the AI keeps assuming the standard way.

If you want to understand why models behave like this, my post on the architecture of LLMs explains how they predict from patterns, not from real knowledge of your system.

Signs you should stop prompting

The trick is to notice the loop early. Here are the signals I watch for:

  • The same suggestion comes back more than once.
  • Each fix creates a new, different error.
  • You are copying code you do not understand into your project.
  • You can no longer explain what the code is doing.
  • You feel frustrated, and your prompts are getting shorter and angrier.

When you see two or more of these, it is time to step away from the chat. That is the practical answer to when not to use AI: when it is no longer adding understanding, only noise.

How to read the code effectively

Reading code sounds slow, but a focused read often finds the bug faster than another ten prompts. A simple approach:

  1. Reproduce the bug reliably. Know the exact steps and the exact wrong result.
  2. Find the entry point. Start where the request, event or function call begins.
  3. Follow the data. Trace one value from input to output. Note where it changes.
  4. Check your assumptions. Add logs or breakpoints where you think you know the value. Check that you are right.
  5. Look at recent changes. Many bugs come from the last thing someone changed. Version control history is your friend.

This is the same discipline as rubber duck debugging, which I wrote about in why rubber duck debugging still works. Slow down and explain each step.

Come back with a better question

Reading the code is not the end of AI. It is a reset. After a focused read, you usually know much more about the problem, and that turns into a much better prompt.

A weak prompt: "This is broken, fix it."

A strong prompt: "This function receives an order with a null customer ID when the cart is created by a guest user. The ID is set in the session middleware, but only after login. What is a clean way to handle guest carts here?"

The second prompt includes the real cause, the relevant context and a clear goal. AI is very good at helping with that kind of question. Some tips for the restart:

  • Start a fresh chat. Old failed attempts pollute the context.
  • Include the right files. Give the AI the code you found, not just the error.
  • State what you already ruled out. This stops it repeating old guesses.

A simple rule of thumb

Many developers find a personal limit helpful. For example: if three prompts have not moved you closer, stop and read the code. The exact number matters less than having a rule at all. It turns a vague feeling of frustration into a clear decision point.

Knowing when not to use AI does not make you less of an AI user. It makes you a better one. The engineers who get the most from these tools are the ones who know where the tool ends and their own thinking has to begin. I describe how I balance this every day in my AI Native engineering workflow.

If you want help building healthy AI habits across your team, get in touch.

How many prompts before you give up and read the code?

First shared on LinkedIn.


Subscribe to my newsletter

Read articles from Tech With Asim | Learn, Build, Lead directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Comments

Loading comments…