Write To File Expression Bug

Describe the problem/error/question

When I write a file to {{ $execution.id }}.json it creates a file named 123.json. when I write the file to backup/{{ $execution.id }}.json the file name is {{ $execution.id }}.json.

Expressions are not working when writing outside the root folder. However, the file is created and the data is accurate.

Please share your workflow

Information on your n8n setup

  • n8n version: 1.109.2
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: Windows Server 2025

Hey @James_Stephens, hope all is well.

ran your wf, here is what’s in the container

~ $ pwd
/home/node


~ $ tree
.
└── backup
    └── 10513.json

1 directories, 1 files
~ $

You are on windows and npm? Doesn’t seem like a comparable example if you are not using the same setup. But it is good to know it works for some setups out there.

As per Jon on discord, “It should be fine, I assume when you say on windows you are using an npm install and not docker? I suspect the / might need to be \ or // or \/"

I will try to different combinations tomorrow and report back.

1 Like

@Jon Thanks Jon! Changing from the traditional windows \ to / between directories fixed the issue. However, this still feels like a bug, so I am not marking it resolved in hopes someone will handle this issue.