My Email Trigger (IMAP) node keeps showing “Custom email config is not valid JSON” error. I have cleared the Custom Email Rules field completely and even replaced the node entirely but the error persists. The IMAP credential is connected and tested successfully.
I am using n8n Cloud. The error appears even after: 1) clearing the Custom Email Rules field, 2) replacing the node entirely with a fresh one, 3) reconnecting the IMAP credential (which tests successfully). The error “Custom email config is not valid JSON” fires instantly in 25-40ms suggesting it’s stored in the workflow JSON itself rather than the node UI. Is there a way to edit the workflow JSON directly to remove the bad config?
Ive used ChatGPT, Claude and n8n ai no one seems to be able to solve it!!
How do I permanently fix this?
-
Test a completely new workflow with a new IMAP node.if the problem is embedded in the old workflow JSON, a new workflow should not inherit it
-
If the error still appears in a brand‑new workflow with a fresh IMAP node and empty Custom Email Rules, then this is likely a workspace-level or cloud-side issue open an n8n Cloud support ticket with:
-
Workspace ID
-
Workflow ID
-
A short description that the IMAP node’s “Custom Email Rules” JSON seems stuck/corrupted at the workflow level even when the field is empty and the node is replaced.
You can try this to manually remove the bad config, before talking with support.
- go to your n8n canvas and click anywhere on the background.
- press
Ctrl + Ato select all your nodes. - press
Ctrl + Cto copy them. - open a plain text editor on your computer (like Notepad,VS Code) and paste the code. you will now see your entire workflow structure written in JSON.
- search the text for
"customEmailConfig"or"customEmailRules". - you will likely find a line where it is set to an empty string (e.g.,
"customEmailConfig": ""). strictly delete that entire line. - select all the text in your editor and copy it again.
- go back to your n8n canvas, delete the old nodes, and just Paste (
Ctrl + V).
n8n will instantly rebuild your workflow, and hopefully that configuration will be gone.
Hi @Mark_Rosenberg Welcome to the community!
I would have said that just remove that node from the UI, but now just open any text editor like VScode and open that workflow JSON file and remove that trigger’s entry from that JSON and once you do that there is no way to actually verify is that JSON is correct or not so for that use a service like
and just connect this with any AI companion and so this would help you even create your workflows and for this case this would help you validate that JSON, or better just ask the agent to remove that.
You’re right that the bad config is baked into the workflow JSON itself. On n8n Cloud you can export it by clicking the three-dot menu in the top right corner and selecting Download, open that JSON file in any text editor, search for customEmailConfig and just delete that entire key-value pair (it’ll be somewhere inside the IMAP node’s parameters.options object), then save and re-import via the same menu using Import from File. That should clear out whatever malformed config is stuck in there.