Errors with Imap Trigger

Describe the issue/error/question

I am starting a workflow with an IMAP trigger, and it seems to be working, but get some frequent runs of the error workflow.

What is the error message (if any)?

There was a problem with the trigger node “Email Trigger (IMAP)”, for that reason did the workflow had to be deactivated

Information on your n8n setup

  • n8n version: 0.221.2
  • Database you’re using (default: SQLite): Postgre
  • Running n8n with the execution process [own(default), main]: queue
  • Running n8n via [Docker, npm,, desktop app]: Docker

Hey @Martin_Neumann,

Is this a new workflow or an old workflow? When the error occurs does anything appear in the n8n logs?

It is an older workflow but I deleted and placed again the Imap Trigger like it was suggested in another post. Seems I have no debug logging configured on my instance, let me know which log level I should try.

Try debug as the option, but it might be worth checking your worker nodes logs as well to see if there is anything there.

I activated the debug option and looked at the log files inside of portainer. Directly inside of docker I did not find the location of the log files. What I found were several entries of this nature:
PostHog Debug capture {
distinct_id: ‘f66b6bfff7f7e314fa4555a35fc65de6e43174f33626fad291d947fef6248b77#42dec383-cd50-4c35-8a5b-427114976d2d’,
event: ‘Workflow execution count’,
properties: {
event_version: ‘2’,
workflow_id: ‘24’,
user_id: ‘42dec383-cd50-4c35-8a5b-427114976d2d’,
prod_success: { count: 7, first: 2023-04-04T18:33:25.547Z },
instance_id: ‘f66b6bfff7f7e314fa4555a35fc65de6e43174f33626fad291d947fef6248b77’,
version_cli: ‘0.221.2’,
‘$groups’: undefined,
‘$active_feature_flags’: [ ‘schema-view’, ‘start-at-wf-empty-state’ ],
‘$feature/schema-view’: true,
‘$feature/start-at-wf-empty-state’: ‘test’,
‘$lib’: ‘posthog-node’,
‘$lib_version’: ‘2.6.0’
type: ‘capture’,
library: ‘posthog-node’,
library_version: ‘2.6.0’,
timestamp: ‘2023-04-04T20:23:17.878Z’

After several of this entries I found this:
2023-04-04T20:23:37.697Z [Rudder] debug: in flush
2023-04-04T20:23:37.697Z [Rudder] debug: cancelling existing timer…
2023-04-04T20:23:37.697Z [Rudder] debug: cancelling existing flushTimer…
2023-04-04T20:23:37.697Z [Rudder] debug: batch size is 8
2023-04-04T20:23:57.984Z [Rudder] debug: in flush
2023-04-04T20:23:57.984Z [Rudder] debug: cancelling existing timer…
2023-04-04T20:23:57.985Z [Rudder] debug: queue is empty, nothing to flush

It was similar for the Webhook and the Worker containers. For the actual workflow executions I did not find any debug info, neither for the mysterious errors that are getting triggered by the IMAP trigger.

Did you check the worker nodes as well? I would expect to see some output from the imap node as we have some debug lines in there.

How often does the error occur and is it always around the same time?

The error fires about 50x a day and in irregular intervals. I checked the IMAP trigger is firing correctly for every email that has arrived. The output I have sent you is from the containers of the trigger and worker nodes (queue mode installation), which are pretty similar. The strange thing is that even my correctly processed workflows did not produce any debug output in the logs. Besides the log in the Portainer, is there any other log to look at when on a Docker installation?

Hey @Martin_Neumann,

That should be it, If I try the same thing on my Portainer based install I get the below so I can see that the workflow is running.

2023-04-05T13:40:48.360Z | debug    | Wait tracker querying database for waiting executions "{ file: 'WaitTracker.js', function: 'getWaitingExecutions' }"
2023-04-05T13:41:16.844Z | debug    | Remove editor-UI session "{\n  sessionId: 'wm1783ejusl',\n  file: 'abstract.push.js',\n  function: 'remove'\n}"
2023-04-05T13:41:19.533Z | debug    | Querying for new messages on node "EmailReadImap" "{\n  searchCriteria: [ 'UNSEEN', [ 'UID', '14:*' ], [ 'UID', '14:*' ] ],\n  file: 'EmailReadImapV2.node.js',\n  function: 'onmail'\n}"
2023-04-05T13:41:19.836Z | debug    | Received trigger for workflow "IMAP TEST" "{ file: 'ActiveWorkflowRunner.js', function: 'returnFunctions.emit' }"
2023-04-05T13:41:19.879Z | verbose  | Execution for workflow IMAP TEST was assigned id 1741677 "{\n  executionId: '1741677',\n  file: 'WorkflowRunner.js',\n  function: 'runMainProcess'\n}"
2023-04-05T13:41:19.879Z | verbose  | Execution for workflow IMAP TEST was assigned id 1741677 "{\n  executionId: '1741677',\n  file: 'WorkflowRunner.js',\n  function: 'runMainProcess'\n}"
2023-04-05T13:41:19.884Z | debug    | Execution ID 1741677 had Execution data. Running with payload. "{\n  executionId: '1741677',\n  file: 'WorkflowRunner.js',\n  function: 'runMainProcess'\n}"
2023-04-05T13:41:19.885Z | verbose  | Workflow execution started "{\n  workflowId: '482',\n  file: 'WorkflowExecute.js',\n  function: 'processRunExecutionData'\n}"
2023-04-05T13:41:19.888Z | debug    | Executing hook (hookFunctionsPush) "{\n  executionId: '1741677',\n  sessionId: undefined,\n  workflowId: '482',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteBefore'\n}"
2023-04-05T13:41:19.891Z | debug    | Start processing node "Email Trigger (IMAP)" "{\n  node: 'Email Trigger (IMAP)',\n  workflowId: '482',\n  file: 'WorkflowExecute.js'\n}"
2023-04-05T13:41:19.892Z | debug    | Running node "Email Trigger (IMAP)" started "{\n  node: 'Email Trigger (IMAP)',\n  workflowId: '482',\n  file: 'WorkflowExecute.js'\n}"
2023-04-05T13:41:19.892Z | debug    | Running node "Email Trigger (IMAP)" finished successfully "{\n  node: 'Email Trigger (IMAP)',\n  workflowId: '482',\n  file: 'WorkflowExecute.js'\n}"
2023-04-05T13:41:19.893Z | debug    | Save execution progress to database for execution ID 1741677  "{\n  executionId: '1741677',\n  nodeName: 'Email Trigger (IMAP)',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'nodeExecuteAfter'\n}"
2023-04-05T13:41:19.900Z | verbose  | Workflow execution finished successfully "{\n  workflowId: '482',\n  file: 'WorkflowExecute.js',\n  function: 'processSuccessExecution'\n}"
2023-04-05T13:41:19.901Z | debug    | Executing hook (hookFunctionsSave) "{\n  executionId: '1741677',\n  workflowId: '482',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"
2023-04-05T13:41:19.902Z | debug    | Save execution data to database for execution ID 1741677 "{\n  executionId: '1741677',\n  workflowId: '482',\n  finished: true,\n  stoppedAt: 2023-04-05T13:41:19.900Z,\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"
2023-04-05T13:41:19.907Z | debug    | Executing hook (hookFunctionsPush) "{\n  executionId: '1741677',\n  sessionId: undefined,\n  workflowId: '482',\n  file: 'WorkflowExecuteAdditionalData.js',\n  function: 'workflowExecuteAfter'\n}"

If you go to Help > About there is an instance ID are you able to send that to me? I can see if we have any odd errors in our telemetry.

Strange that I do not get the same output in my log files. I have set these 2 parameters in the docker config file:
- N8N_LOG_LEVEL=debug

My instance ID is:

Hey @Martin_Neumann,

Did you set a file path? I didn’t change the output so that it stuck with console.

I didn´t set a path, just this 2 values. And I got lost inside of the docker container to know where the log files can be found. So what shall I do to resolve that?

I just migrated all the workflows of my n8n instance to a new server and still have the same error. What can I do to debug that problem?

Hey @Martin_Neumann,

If you set a path for the debug logs to be written to or change the output to console it should give us more.

Which mail provider are you using as well? At this point the best thing I think I can do is try to setup something close to your environment to try and work out what is causing the issue. In my testing I have been using GMail and have not seen the issue so it might be that I need a service that occasionally drops.

Have you also tried changing the polling frequency?

I don’t get that logging to work. Can you give me detailed instructions how to enable logging in a docker environment?

And my email server is from Siteground. If you have access to a siteground server, you can try monitor an email from them to see if there is an issue with their Imap setup.

Hey @Martin_Neumann,

Can you change N8N_LOG_OUTPUT to console or set N8N_LOG_FILE_LOCATION to point to a file your container can write to.

The documentation for this can be found here: Logging - n8n Documentation

The results should show in the console log of the browser? I don´t see any! And to decide on a writable path in the docker container, can you make a suggestion since you are the maintainer of the docker image? Or if I need to set permissions for a specific folder, which process should be set as the owner? If you can give me specific instructions I will try to implement them.

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