IMAP Email ERROR: command or literal size is too large


Can something be done about it?

Too many letters? There are about 40,234 letters in total.
There are about 3,237 in the inbox.
Over 30,000 unread…

Information on your n8n setup

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

Hey @Mikhail,

That is a fair few emails to check, Have you tried setting a custom email rule under options? The default option would be to check for any unseen emails and if you are not marking them as read on each run I suspect it will be trying to process 30,000 emails on each run.

1 Like

Hey @Jon ! Thank you so much for your reply!

In here:

Insert the appropriate code from this page ( as in the example)? Did I get that right?

Hey @Mikhail,

Unseen is the default value but you are in the right place, You would need to find an option that works for your mailbox. Maybe a filter on the date so something like [ 'UNSEEN', ['SINCE', 'Octover 31, 2022'] ]

1 Like

I’ll give it a try and report back!

1 Like

Hey @Jon !

Unfortunately, I got this:

I also tried this:
[ [‘HEADER’, ‘SUBJECT’, ‘my header’] ]
It was the same error.

This one works, with a " instead of a ’ :

[“UNSEEN”,[“SINCE”,“Octover 20,2022”],[“HEADER”, “SUBJECT”, “my header”]]

Now it goes “Executing node…” and nothing happens.

I even made all e-mails “read” and left 1 unread - the one for which the algorithm should work.
All the same - no result - just Executing node…


Hey @Mikhail,

Does it eventually timeout? What happens if you try a folder with less in it does that work?


I didn’t wait for it to give me a result.
Now I’m going to try and leave it and see what happens…
It’s been running for 2 hours 20 min…

On other folders - it gives an error. I tried different ones:

or in English:

Maybe hierarchy is also important.
If so, how to write it correctly?
Inbox/Support or /Support

Hey @Mikhail,

Looking at the API docs it expects the path so it would depend on what the Mail Server calls it. That looks like it could be Inbox/Support unless the server gives it a different name.

What mail server are you using?

Hey @Jon