If a LocalFileTrigger is configured with the ignore option but no input (default is an empty string) or the input is deleted, but the ignore option is not deleted, this will result in a crash of n8n. n8n is even not able to restart, because the LocalFileTrigger is executed on startup.
Log / Stacktrace:
/usr/local/lib/node_modules/n8n/node_modules/picomatch/lib/picomatch.js:48
throw new TypeError('Expected pattern to be a non-empty string');
^
TypeError: Expected pattern to be a non-empty string
at picomatch (/usr/local/lib/node_modules/n8n/node_modules/picomatch/lib/picomatch.js:48:11)
at createPattern (/usr/local/lib/node_modules/n8n/node_modules/anymatch/index.js:27:18)
at /usr/local/lib/node_modules/n8n/node_modules/anymatch/index.js:91:21
at Array.map (<anonymous>)
at anymatch (/usr/local/lib/node_modules/n8n/node_modules/anymatch/index.js:91:6)
at FSWatcher._isIgnored (/usr/local/lib/node_modules/n8n/node_modules/chokidar/index.js:776:25)
at NodeFsHandler._addToNodeFs (/usr/local/lib/node_modules/n8n/node_modules/chokidar/lib/nodefs-handler.js:581:16)
at /usr/local/lib/node_modules/n8n/node_modules/chokidar/index.js:451:47
at Array.map (<anonymous>)
at FSWatcher.add (/usr/local/lib/node_modules/n8n/node_modules/chokidar/index.js:450:13)
at watch (/usr/local/lib/node_modules/n8n/node_modules/chokidar/index.js:969:11)
at Object.trigger (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js:179:46)
at Workflow.runTrigger (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:570:33)
at ActiveWorkflows.add (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/ActiveWorkflows.js:26:50)
at async ActiveWorkflowRunner.add (/usr/local/lib/node_modules/n8n/dist/ActiveWorkflowRunner.js:475:17)
at async ActiveWorkflowRunner.init (/usr/local/lib/node_modules/n8n/dist/ActiveWorkflowRunner.js:72:21)
at async /usr/local/lib/node_modules/n8n/dist/commands/start.js:274:17
at async Start.run (/usr/local/lib/node_modules/n8n/dist/commands/start.js:116:9)
at async Start._run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/command.js:43:20)
at async Config.runCommand (/usr/local/lib/node_modules/n8n/node_modules/@oclif/config/lib/config.js:173:24)
at async Main.run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/main.js:28:9)
at async Main._run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/command.js:43:20)
To Reproduce
Steps to reproduce the behavior:
Add 'LocalFileTrigger' node
Select 'Trigger On' -> 'Changes to s Specific File'
Insert some path for 'File to Watch', non existing files are valid, so you may insert something like '/tmp/tmp.txt'
Click 'Add Option'
Click 'Ignore'
Save workflow
Activate workflow
Expected behavior
n8n should not crash (on startup).
Environment (please complete the following information):
OS: [Ubuntu 20.04.5]
n8n Version [master (915f1445c26d834e3d43602f901a198931a107e1)]
Node.js Version [v18.12.1]
Database system [SQLite]
Operation mode [own?]
Additional context
Get n8n working again
If you run in this issue an can not start n8n again, try to export your workflows: n8n export:workflow --all --pretty
Remove the empty ignore option from the LocalFileTrigger node and import your workflows again.
Thanks for the report and the work you have done putting in the PR to fix this one, I have given it a test and with your fix it is working as it should. Nice work 🙌🏻
Describe the bug
If a LocalFileTrigger is configured with the ignore option but no input (default is an empty string) or the input is deleted, but the ignore option is not deleted, this will result in a crash of n8n. n8n is even not able to restart, because the LocalFileTrigger is executed on startup.
Log / Stacktrace:
To Reproduce Steps to reproduce the behavior:
Expected behavior
n8n should not crash (on startup).
Environment (please complete the following information):
Additional context
If you run in this issue an can not start n8n again, try to export your workflows:
n8n export:workflow --all --pretty
Remove the empty ignore option from the LocalFileTrigger node and import your workflows again.