I asked it to investigate an error, then it told me and simply changed the workflow to a differently broken state…
Due to the lack of a revert button, I’ve asked it to revert the changes and every single time it got worse and worse removing more of my code I created before …
The code was actually also created by n8n but wasn’t working as expected …
Turn on n8n Workflow History
If you plan to use n8n’s AI features, you must rely on source control or manual backups.
If you are on n8n Cloud or Enterprise: Make sure Workflow History is enabled in your settings. This creates automatic versions and snapshots every time a workflow is saved or modified, allowing you to roll back to a version from 10 minutes ago with one click.
If you are Self-Hosting: Set up the Git Integration in n8n. This pushes your workflow JSONs to a private GitHub/GitLab repository. If the AI breaks your workflow, you can simply discard the local changes or pull the last clean commit.
You can also use the “Duplicate” Safety Net
Before you ever hand a prompt over to an autonomous agent to “investigate an error,” get into the habit of duplicating your current progress:
Go to the top right menu of the workflow and click Export. Save the JSON file locally.
Alternatively, select all your working nodes, copy them, and paste them into a blank scratchpad workflow or a text editor as a quick backup.
Best Practices to use AI: You either have to isolate it, and let it edit and fix errors in a workflow that is separate from your main workflows, and then copy the fixes and edits, or you can ask it to just “Provide the updated JavaScript/Python code inside the chat window. Do not modify my canvas directly.”, a prompt like that and then you can add the nodes based of your review. Hope this helps you.
i think you save/download your workflow before ai changes your workflow(anticipation).
Shouldn’t there be a button:
Revert to previous state?!?
If you set up GIt integration in n8n or enable Workflow Settings in your setting if you are using n8n cloud, you can easily revert it back. Did you set up any of those?
This is something that should be integrated into the AI feature
Hey,
Thanks for the tips! However, I actually initially didn’t intend to do changes…
I got an error in my script, and wanted to understand what’s happening and clicked the “Explain with AI” button which sent a message for me.
Then it explained it to me and thought it would just fix it for me as well …
The version history is a good tool to revert the changes but there:
- should be buttons to revert it with one click
- be a separation of explaining/planning vs editing
- have insight into what it did before
And if Cmd+Z work that’s amazing was not intuitive that it would work for changes I didn’t do.
Dennis
hey @Dennis_Kugelmann , good morning!
I understand your frustration, seeing our work altered without request is really a headache. Your case made me think about how we should be careful with AIs.
the n8n AI is available to support us, but its use should be our responsibility, the user’s responsibility to know how to handle the tool that came to help and if you don’t know how to use it, like any tool, it’s going to give you a lot of headaches.
Just to make it clear that your idea is great, but it’s a feature that should be explained in the “feature request” category, not a flaw in the n8n tool

One practical tip for now: before prompting the AI, select only the specific nodes you want it to modify, then frame your request as “fix only the selected nodes” or “rewrite only the Code node named X”. The AI is more likely to stay scoped when you give it explicit boundaries. Also, if you use n8n Cloud, Workflow History saves a snapshot on every save - so hitting Ctrl+Z after an AI edit and then immediately saving gives you a clean restore point in history.
This is one of the most frustrating things that can happen and unfortunately it’s a known limitation of letting AI edit live workflows without a proper version history.
A few things worth knowing going forward:
Before asking the AI to investigate or fix anything, duplicate the workflow first. That way you always have a clean copy to fall back on no matter what the AI does to the original.
When the AI starts making changes and breaks things further, stop asking it to revert, it doesn’t have a true memory of what the original looked like and every “revert” attempt is just another guess that makes things worse as you’ve seen.
If you still have the execution history, open a previous successful execution and use the input/output data from each node to manually trace back what the code was doing before the AI touched it.
For the actual error you were trying to fix, Cannot assign to read only property name, that usually means somewhere in the code a built-in JavaScript object property is being modified directly. The fix is to create a copy of the object first before modifying it rather than editing it in place.
Going forward treat the AI assistant as a consultant not an editor, ask it to explain what’s wrong and suggest a fix, then make the change yourself so you stay in control of what actually changes in the workflow.