Discord Integration throwing an error into the success path

I have been using the discord integration and a discord bot to post messages with attachements on discord. Since I dont use premium account for the bot, it cant post anything above 10MB on Discord.

thats sad, but I can work with that, so I added the Option “On Error - Continue (using error output)” which creates a Success path for succesful posting and an error path.

The problem here is, when my bot throws the error of the attachement being too large, it wont continue on the Error path.

[{“error”: “{\“message\”: \“Request entity too large\”, \“code\”: 40005}”}]

Seems very much like a bug too me.

Information on your n8n setup

  • n8n version: 1.123.5
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker Desktop, self hosted
  • Operating system: Win 10

Hi @LVV !

The error {"message":"Request entity too large","code":40005} is a Discord limit, not an n8n issue. In this case, the Discord node receives a valid HTTP response from the Discord API, so n8n does not treat it as a node execution failure, and therefore “On Error → Continue (using error output)” is not triggered. When the error is returned as structured output data, n8n considers the node execution successful, even though Discord rejected the request. This explains why the error branch is not followed, even with the option enabled.

Solution

Do not rely on the Discord node error output. Prevent the error before calling the node.

Recommended workflow pattern:

  1. Before the Discord node, check the attachment size (via IF / Function / Set node).
  2. Branch the flow:
  • ≤ 10 MB → Send message with attachment via Discord node.
  • 10 MB → Alternative flow (send text only, upload to external storage and post a link, etc.).

  1. Use the Discord node only when the payload is guaranteed to be within Discord limits.

Optional fallback (if the Discord node already ran):

  • Add an IF node after the Discord node and check:
{{ $json.error?.code === 40005 }}
  • Manually route to an alternative flow.

This approach is stable, predictable, and aligns with current n8n and community best practices.

Hi @LVV This is not an error you are seeing it is a known Discord response, they do not consider this as a failure, as for now the best solution is to use an HTTP node with setup like:
Set the method to POST.

  1. Use the URL: https://discord.com/api/v10/channels/<CHANNEL_ID>/messages

  2. Add an Authorization header: Bot <YOUR_BOT_TOKEN>

  3. Set the body to “form-data” and add your content and file fields.

This HTTP node would give you more control over, else if you want to stay with your current setup just make sure the file size is less than the discord API allows, hope this helps.