Unable to write file in local system

Unable to write file in local system

What is the error message (if any)?
Problem in node ‘Read/Write Files from Disk‘
The file “file.json” is not writable.

Please share your workflow

{
“nodes”: [
{
“parameters”: {},
“type”: “n8n-nodes-base.manualTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
],
“id”: “3d54707a-113c-4410-8014-86f88421efa2”,
“name”: “When clicking ‘Execute workflow’”
},
{
“parameters”: {
“url”: “https://poetrydb.org/random/1”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.3,
“position”: [
208,
0
],
“id”: “1aa751f1-3e37-4e9b-b949-390c767a2f16”,
“name”: “HTTP Request”
},
{
“parameters”: {
“operation”: “toJson”,
“options”: {}
},
“type”: “n8n-nodes-base.convertToFile”,
“typeVersion”: 1.1,
“position”: [
416,
0
],
“id”: “ab616b85-7c15-4b8d-93bb-865a272efa01”,
“name”: “Convert to File”
},
{
“parameters”: {
“operation”: “write”,
“fileName”: “file.json”,
“options”: {}
},
“type”: “n8n-nodes-base.readWriteFile”,
“typeVersion”: 1,
“position”: [
624,
0
],
“id”: “40231406-e20d-4be6-ac13-df185a294a92”,
“name”: “Read/Write Files from Disk”
},
{
“parameters”: {
“operation”: “write”,
“fileName”: “C:\Users\Aimscoder\my_file.json”,
“options”: {}
},
“type”: “n8n-nodes-base.readWriteFile”,
“typeVersion”: 1,
“position”: [
832,
0
],
“id”: “1d4a3afc-8e10-4d71-a9cc-e03490dc95f3”,
“name”: “Read/Write Files from Disk1”
}
],
“connections”: {
“When clicking ‘Execute workflow’”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTTP Request”: {
“main”: [
[
{
“node”: “Convert to File”,
“type”: “main”,
“index”: 0
}
]
]
},
“Convert to File”: {
“main”: [
[
{
“node”: “Read/Write Files from Disk”,
“type”: “main”,
“index”: 0
}
]
]
},
“Read/Write Files from Disk”: {
“main”: [
[
{
“node”: “Read/Write Files from Disk1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “99738a7b4791987c3cb93fa2df41ddfdd11e9ebe07112c934fb89844b565c272”
}
}

Share the output returned by the last node

{
“errorMessage”: “The file "file.json" is not writable.”,
“errorDetails”: {
“rawErrorMessage”: [
“The file "file.json" is not writable.”
]
},
“n8nDetails”: {
“nodeName”: “Read/Write Files from Disk”,
“nodeType”: “n8n-nodes-base.readWriteFile”,
“nodeVersion”: 1,
“operation”: “write”,
“itemIndex”: 0,
“time”: “12/31/2025, 12:14:46 PM”,
“n8nVersion”: “2.0.3 (Self Hosted)”,
“binaryDataMode”: “filesystem”,
“stackTrace”: [
“NodeApiError: The file "file.json" is not writable.”,
" at ExecuteContext.execute (C:\Users\Aimscoder\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\nodes\Files\ReadWriteFile\actions\write.operation.ts:123:10)“,
" at ExecuteContext.execute (C:\Users\Aimscoder\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\nodes\Files\ReadWriteFile\ReadWriteFile.node.ts:69:17)”,
" at WorkflowExecute.executeNode (C:\Users\Aimscoder\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\workflow-execute.ts:1045:8)“,
" at WorkflowExecute.runNode (C:\Users\Aimscoder\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\workflow-execute.ts:1226:11)”,
" at C:\Users\Aimscoder\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\workflow-execute.ts:1662:27",
" at C:\Users\Aimscoder\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\workflow-execute.ts:2274:11"
]
}
}

Information on your n8n setup

  • n8n version: 2.0.3
  • Database (default: SQLite): PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Win 11

Welcome to the community :tada: @Nayan_Thakor

Can you insert your workflow code using the <\> pre formatted text.

Hey @Brighto,
Thanks for your response, Here it is

Ok @Nayan_Thakor To solve this, you should remove the C:\Users\… path from your node and let it write to the default location. If you absolutely need the file in your user directory, you must configure the N8N_USER_FOLDER environment variable to point there.

@Brighto
Tried as you explained

Still it’s showing the same error.

I am using a Docker environment, and this configuration is effective. You can try the following variables: replace /data with your local path, and ensure you use absolute paths for all file read/write operations.

N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=false

N8N_RESTRICT_FILE_ACCESS_TO=/data

N8N_FILESYSTEM_ALLOW_LIST=/data

Hi @ostaer
Thanks, but I want to have the solution within an npm with windows itself.
I know at the end I have an option to make it with with Docker but I wanted to make it work with npm.
Still, I appreciate your suggestion.

These variables aren’t limited to Docker; they are applicable to your Windows/npm setup as well. Check out this link for reference: n8n-docs/docs/hosting/configuration/environment-variables/security.md at main · n8n-io/n8n-docs · GitHub

It is an n8n 2.x instance, right? Since n8n 2.0 a breaking change is the restriction of access to the file system:

You can adjust this restriction with the environment variable N8N_RESTRICT_FILE_ACCESS_TO.
In order to bypass this restriction, you can set this variable to ““ (empty string).
In your case of an npm based instance (on a windows host?) you can try to set it with this command:
set N8N_RESTRICT_FILE_ACCESS_TO=""
… and restart n8n afterwards.

Also see configuration methods here:

2 Likes

Bingo, That worked like a charm.

Thanks @markup

2 Likes

In case of queue execution mode for self-hosted n8n using docker, do we need to set this for both the worker and the main n8n containers ?

I’ve never used the queue mode, but as far as I understand, you need to set file access only for the worker that does the actual job. I don’t think you need to set it for the main instance.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.