Read file and write file not working,anyone help?

i updage n8n to 2.0 version,i found the read and write file node not working anymore,first,it show file not allow to access,then i searche the internet and set the envirement variable:
set N8N_BLOCK_STORAGE_FILESYSTEM_PATHS=C:,D:,E:
set N8N_BLOCK_FS_WRITE_ACCESS=false
set N8N_BLOCK_FS_READ_ACCESS=false
set N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=false
set N8N_BLOCK_NODES=“”
set NODES_EXCLUDE=“
set N8N_RESTRICT_FILE_ACCESS_TO=“C:\tmp”
set N8N_BINARY_DATA_MODE=filesystem
n8n start

now,i excecute the read node agane ,the error changed,now error shows:**The file has changed and cannot be accessed.
**
even i change the file path any else or the file in i set where inside C:\tmp,it still not working ,show the same error

Hi @yongshao_chen Welcome!
Can you please consider removing quotes from

just keep it as set N8N_RESTRICT_FILE_ACCESS_TO=C:\tmp and then restart n8n

still the same ,error is :The file has changed and cannot be accessed.

Hi @yongshao_chen

If you use docker, please see my article, it may help:

now i use the npm install version

@yongshao_chen i think the fix is to actually switch from NPM version to docker, as npm is really good but it is hard to work with when dealing with env variables. Please switch to docker via:

:sweat_smile: i think docker is too complex ,npm is fine to me ,alse the npm version which i create many workflow,migration is not a easy thing

I agree with Mr Anshul_Namdev,
If you want to keep npm setup, try the following:

Test with memory mode first

set N8N_BINARY_DATA_MODE=memory

Then: Restart n8n and run the workflow again. If it works, then the problem is specifically related to filesystem mode.


Simplify the environment variables

set N8N_BLOCK_STORAGE_FILESYSTEM_PATHS=C:,D:,E:
set N8N_BLOCK_FS_WRITE_ACCESS=false
set N8N_BLOCK_FS_READ_ACCESS=false
set N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=false
set N8N_BLOCK_NODES=""
set NODES_EXCLUDE=""

If another app, script, or workflow step edits the file after n8n reads it, n8n may reject it.


If the same file is read more than once, or passed through nodes that alter it, try copying it to a new filename first and test again.


Do the test:

test is:

  • create a file in C:\tmp,read it once, do not modify it, see whether the second node can still access it

both mothod you provide not working,is so weird,i install a npm version of n8n in my other computer,i just start with “n8n start“,everything is ok,read file or write file is working,but my now computer,even setting lot of variable still get error

Lets review:

N8N_BINARY_DATA_MODE is not the documented setting for binary storage

the docs use N8N_DEFAULT_BINARY_DATA_MODE. In n8n v2xxx, default means in memory,

filesystem, database, and s3 are the supported modes.

N8N_RESTRICT_FILE_ACCESS_TO also expects directories separated by semicolons.

For the Read-Write Files from Disk node, use an absolute path and make sure the file is not being modified by another process while n8n is reading it.

Because the same setup works on other computer, I guess that this machine has a local file-locking or file-change issue. For that I asked you to copy the file to a new static filename in:

C:\tmp and read that copy, with no other app touching it.

i restart computer,close every app,only using cmd,still not worki on reading a copy file in C:\tmp ,i wonder if i resintall the n8n will working,do you know how to maintain all the workflow after i resinstall a newer version of n8n

Beware:

before updating or reinstalling n8n,

back up everything first.

Export all workflows,

export credentials,

save the database,

keep the same encryption key,

and record all environment variables and custom node paths.

If you use filesystem binary storage, back up those files too.

Otherwise, you may lose data or make existing credentials unreadable.

So, put a plan, think carefully,

thank you very much

Glad it worked out! For anyone else hitting this after upgrading to n8n 2.x, the key change is that n8n now has filesystem access restrictions enabled by default for security.

The important env vars to check:

  • N8N_BINARY_DATA_MODE=filesystem (to use file-based storage)
  • N8N_BLOCK_STORAGE_FILESYSTEM_PATHS should NOT list your target path
  • Make sure your working directory is accessible

On Docker, also check if the path is properly mounted as a volume. A lot of people miss that the path exists inside the container but the n8n process doesn’t have write permission there.

Hello,

What did you do exactly to solve that issue ?