Fresh install n8n failed to start related to IMAP and part.encoding.toUpperCase();

I install a fresh install on Docker, setup first workflow to connect to imap and print out. At first test, n8n show workflow can read email from imap. Then 30 sec later, server down.
Console show this

Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 0.197.1

Start Active Workflows:

  • My workflow (ID: 1)
    => Started

Editor is now accessible via:
http://localhost:5678/

Press “o” to open in Browser.
/usr/local/lib/node_modules/n8n/node_modules/imap-simple/lib/imapSimple.js:212
var encoding = part.encoding.toUpperCase();
^

TypeError: Cannot read properties of null (reading ‘toUpperCase’)
at /usr/local/lib/node_modules/n8n/node_modules/imap-simple/lib/imapSimple.js:212:46
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Information on your n8n setup

  • **n8n version: latest with docker
  • **Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]:
  • **Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @Trung_Huynh, welcome to the community!

I am sorry to hear you’re having trouble. The IMAP node is somewhat problematic, @Jon is looking into this right now. So if possible, you might want to avoid it for the time being.

That said, I just started up a fresh n8n instance running the n8nio/n8n:0.197.1 docker image, created IMAP credentials and enabled the test workflow below

n8n did not crash for me, and also didn’t have any trouble after starting. The output is pretty much what I’d expect after starting:

image

Are you using a custom docker image by any chance? And can you confirm the exact docker run command or docker compose file you are using?