On Folder Added trigger causes workflow to launch twice over SMB

Describe the problem/error/question

I’m creating a workflow that handles a folder, checks its content (MD5 hash for each file), copies the folder to multiple backup locations and then hands off to a secondary workflow.

This workflow is started by a Local File trigger, set to watch for ‘New Folder Added’ in a specific watchfolder.

The good news is: the workflow works! It launches when I add a new folder in my watchfolder. I’m not running into any errors.

What does NOT work properly is the fact that the workflow seems to get launched twice whenever I start it.

This only happens when I copy the folder over SMB to the N8N server. If I copy the file from one folder into the watchfolder from the server itself, the workflow is only triggered once.

Has anyone else encountered this kind of issues while using the Local File trigger set to Folder Added mode?

What is the error message (if any)?

No errors. Just weird behaviour.

Please share your workflow

The workflow works with a few systems for a client, so I can’t share the workflow, but that shouldn’t matter much since the issue is related to the Trigger node.

Information on your n8n setup

  • n8n version: 1.123.11

  • Database (default: SQLite): SQLite

  • n8n EXECUTIONS_PROCESS setting (default: own, main): default

  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker

  • Operating system: Unraid 7.2.2
    **
    I’m connected to the N8N server via SMB over Tailscale. To test this workflow I copy a folder in the TESTFILES folder in the N8N container to the watchfolder which is also connected to the N8N container. Essentially it’s a local copy, but because I’m executing it over an SMB connection it does not get treated as such.

    **

This is a well-known SMB filesystem event behavior. When you copy a folder over SMB, the server sees two distinct events: the directory creation event when the folder is first made, and a second event when the copy finishes and attributes are flushed. Local copies are more atomic and generally only fire once.

Two ways to handle it in n8n. The cleaner approach is to use the workflow’s static data as a deduplication store. Right after your Local File trigger, add a Code node that checks whether this folder path was already processed in the last minute:

const staticData = $getWorkflowStaticData('global');
const folderPath = $json.path;
const lastRun = staticData[folderPath] || 0;
const now = Date.now();

if (now - lastRun < 60000) {
  return [];
}

staticData[folderPath] = now;
return [$input.item];

If the same path triggers again within 60 seconds, the Code node returns an empty array and the rest of the workflow never runs. The static data persists across executions so it works reliably.

The other option is to add a short Wait node (5 to 10 seconds) at the start, then check the MD5 hash of the folder content before and after the wait. If nothing changed, skip. But the static data deduplication is simpler to set up and handles it cleanly without adding extra delay to your normal processing.

Yeah this is just how SMB handles file copies, it fires multiple filesystem events instead of one clean one. Simplest fix is to add a short Wait node right after your trigger (like 5-10 seconds) and then a Code node that checks if that folder path was already processed recently using workflow static data. Something like this should work as a debounce right after your trigger:

The Wait gives SMB time to finish flushing and the Code node checks if that same folder path was seen in the last 30 seconds — if so it returns nothing and stops the execution. Just update the trigger path and connect the rest of your workflow after the Dedup Check node.