So when I try to write/read files on local machine drive - I am getting ‘The file has changed and cannot be written.’ error.
I added env variables but this didn’t help.
This started after updating to 2.4.6 from 1.x.x
Please check the screenshot attached for more info.
This is expected behavior in n8n 2.x. The recommended solution is to always write to a new file instead of overwriting an existing one.
Generate a unique filename for each execution (for example, by appending a timestamp or execution ID). This avoids the file-change detection introduced in n8n 2.x, which is especially sensitive on Windows.
Example:
C:\Projects\output_{{ $execution.id }}.json
This approach reliably prevents the “The file has changed and cannot be written” error.
Try to write the file in one go, instead of creating it first and then writing to it later.
Use a temporary folder (for example C:\temp\n8n\) — this usually avoids Windows interfering with the file.
Avoid reusing or overwriting the same file path between executions.
If you can, running n8n via Docker or WSL on Windows is the most stable setup long-term.
Your filename using {{ $execution.id }} is actually fine — the problem isn’t the expression itself, but how Windows handles the file between creation and write.