DebugAIdocs

Apply and undo a fix

Preview a fix as a diff, apply it to your file, and take it back if it was wrong.

Nothing is written to your files until you have seen the diff and pressed Apply. If DebugAI cannot place a fix safely, it says why on the fix card and leaves the file alone.

Open the diff

On a fix card, press Preview & Apply Fix. The button reads Opening diff…, then VS Code opens a diff titled DebugAI: Review Fix #1 · cart.py (the rank and the file name). Your file is on the left and the fixed version on the right.

Apply or cancel

Back on the card it says Review the diff above, then confirm or cancel. Press Apply to write the change, or Cancel to leave the file as it is.

When the change lands you get Fix applied to cart.py. Review the change. and the button reads Applied.

Undo, if you need to

For 30 seconds after applying, the card shows Fix applied. with Undo. After that, Ctrl Z in the file still takes the change back: DebugAI writes through the editor, the way your own typing does.

Then run the command that failed again. A fix is done when the error stops, not when the diff looks right.

You'll know it worked when

The command that failed now runs clean. If it fails with a new error, debug that one the same way.

Where a fix goes

DebugAI picks the file in this order, and refuses when none fits:

  1. A fix that is an install command (npm install, yarn add, pnpm add, bun add) is not a file change. You are told to run it in your terminal.
  2. If the answer names a file for the fix, that file, found in your workspace.
  3. A one-line pip install of named packages becomes lines in requirements.txt. A fix written for requirements.txt, .env or .gitignore is added to the end of that file, and the file is created if your project has none. Lines already in the file are skipped.
  4. package.json, tsconfig.json and pyproject.toml are edited only when the fix names the file and its code has that file's shape.
  5. Otherwise, the file the error names.

Making a file that does not exist

When a fix belongs in a file your project does not have yet, such as requirements.txt, DebugAI asks first, in a dialog that shows every line: DebugAI will create requirements.txt in your project root containing:. Press Create file, and you get Created requirements.txt with the fix.

When DebugAI will not apply a fix

These appear on the fix card. In each case Copy still works, and the fix may still be right.

MessageWhat to do
This fix is a command, not a change to a file. Run it in your terminal: and the commandRun the command yourself.
This fix is for cart.py, which DebugAI could not find in this workspace. Open that file and use Copy.The file is outside the open folder, or named differently. Open it and paste the fix in.
This fix belongs in tsconfig.json, which this project does not have. Use Copy and create it yourself.Create the file, then paste.
The error does not name a file, so there is nothing safe to open a diff against. Use Copy and put the fix in yourself.Paste the fix where it belongs, or analyse again with the full stack trace.
DebugAI would not place this fix in cart.py. Nothing in that file matches what the fix changes, and appending it blindly is how a fix ends up in an unrelated file. Use Copy and put it where it belongs.The fix does not match the file as it is now. Place it by hand.
Applying this would leave cart.py with an unclosed block, so DebugAI stopped before writing it. The fix itself may still be right. Use Copy and place it by hand.Paste it and close the block yourself.
requirements.txt already has every line this fix adds.Nothing to add. The cause is elsewhere.
Could not create requirements.txt in your project root. Check the folder is writable, or create the file yourself and use Copy.Check folder permissions, or create the file.
DebugAI could not place this fix automatically. Use Copy and put it in yourself.Place it by hand.

If the file changed while you were reviewing

Before writing, DebugAI reads the file again. If it is not what the diff was built from, nothing is written:

cart.py changed while you were reviewing, so DebugAI did not write over it. Nothing was lost. Run the fix again to rebuild it against the current file.

Undo has the same rule. If you edited the file after applying, it refuses rather than take your edits with it:

cart.py has been edited since the fix was applied, so DebugAI did not undo it. That would have taken your later edits with it. Use Ctrl+Z in the editor instead.

An error inside a library

When an error only points into library code, such as a package under node_modules or site-packages, a fix cannot be applied there. The card says This error is inside a library file, the apply button becomes Copy fix below and stays disabled, and Re-analyze error now → runs DebugAI: Analyze Terminal Error again. Your own code that called the library is the place to change. Open that file and run DebugAI: Analyze Error from it.

The demo from DebugAI: Try Demo Analysis shows the same note. Its example files are not on your machine, so its fixes cannot be applied.

What applying tells DebugAI

Applying a fix records it as helpful, and pressing Copy records that you copied it. Both go to your account as feedback on that answer, which is part of how error memory learns which fix held.

After your third applied fix, DebugAI asks once whether you would leave a review, with Leave a Review and Not Now.

Next

On this page