Handling errors - Continue prompting or reverting back

I’m experimenting with different strategies for handling errors when using AI to generate or modify code. I’ve illustrated two common approaches (see image):

  1. Continue prompting until the error is fixed

→ The AI attempts to patch the error directly in the broken version.

  1. Revert to a stable version and prompt with constraints

→ Go back to a working state and ask the AI to make the change again while avoiding the specific error (e.g. “don’t remove X”).

I’m curious if anyone here has tested these strategies in practice?

• Which approach has worked better for you — especially in longer workflows or complex codebases?

• Have you found a way to automate this decision-making?

• Are there other strategies you’ve used to improve stability and efficiency when working with AI-driven changes?

Would love to hear your thoughts or experiences!

Regards, Kenneth

if i feel that many changes were made + the app is not working, i will revert immediately.

otherwise i will continue prompting until i feel i am in a deep hole which i seemingly can’t get out off - then i will revert as well.