Persistent Discord Node Error in Error Workflow (Self-Hosted v1.103.2) - "Cannot read properties of undefined (reading 'error')"

Hello n8n Community,

My name is Max, and I’m fairly new to n8n and automation in general, really enjoying diving into the platform! I’m currently working through n8n Course Level 2 and have hit a roadblock trying to get the last workflow of the course (the Error Workflow) fully working.

I’m currently working through and encountering a persistent issue with the Error Workflow (Workflow 3) setup. My main workflow (Workflow 2) correctly fails and triggers the error handler, but the Discord node within the Error Workflow consistently fails with a TypeError: Cannot read properties of undefined (reading 'error'). As a result, no error messages are being sent to my Discord channel.

I’ve tried debugged the data, with the help of chatgpt, claude and gemini, verified the input to the Discord node, and confirmed that the expressions appear logically correct based on that input. This leads me to suspect an internal node issue or version-specific bug affecting the Discord node within this Error Workflow context.

The error message observed in the Discord node’s output in the Error Workflow is:

{ "errorMessage": "Cannot read properties of undefined (reading 'error')", "errorDetails": {}, "n8nDetails": { "n8nVersion": "1.103.2 (Self Hosted)", "binaryDataMode": "default", "stackTrace": [ "TypeError: Cannot read properties of undefined (reading 'error')", " at ExecuteContext.parseDiscordError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/helpers/utils.ts:32:30)", " at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/webhook/sendLegacy.operation.ts:153:34)", // ... (rest of stack trace for brevity, but I have the full trace) ] } }

This stack trace points to parseDiscordError within the Discord node’s own code, suggesting an internal problem.

Please share your workflow

Workflow 2 (Main Workflow - Simplified for error generation in n8n Course Level 2):

JSON{ "nodes": [ { "parameters": { "interval": "10", "unit": "seconds" }, "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1, "position": [ 250, 150 ] }, { "parameters": { "errorType": "errorMessage", "errorMessage": "An error occured!" }, "name": "Stop and Error", "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [ 750, 150 ] } ], "connections": { "Schedule Trigger": { "output": [ { "node": "Stop and Error", "port": "main" } ] } } }

Workflow 3 (Error Workflow as per n8n Course Level 2 requirements):

JSON{ "nodes": [ { "parameters": {}, "name": "Error Trigger", "type": "n8n-nodes-base.errorTrigger", "typeVersion": 1, "position": [ 250, 150 ] }, { "parameters": { "connectionType": "webhook", "webhookUrl": "YOUR_DISCORD_WEBHOOK_URL", // Replace with your actual URL "operation": "sendMessage", "message": "The workflow {{ $json.workflow.name }} failed, with the error message: {{ $json.execution.error.message }}. Last node executed: {{ $json.execution.lastNodeExecuted }}. Check this workflow execution here: {{ $json.execution.url }} My Unique ID: 8b09e510b72faa570f586e55496bd62b" }, "name": "Discord", "type": "n8n-nodes-base.discord", "typeVersion": 2, "position": [ 500, 150 ], "credentials": { "discordApi": { "id": "YOUR_DISCORD_CREDENTIAL_ID", // Replace with your actual credential ID "name": "Discord Webhook account 2" // Or your credential name } } } ], "connections": { "Error Trigger": { "output": [ { "node": "Discord", "port": "main" } ] } } }

(Please note: I’ve omitted the full main workflow from the course for brevity, focusing on the error generation. The credential ID and webhook URL in WF3’s Discord node are placeholders.)

Workflow 2 Settings (Error Workflow configured): Workflow 2 is configured to use “Workflow 3 - Error Handler” as its “Error Workflow”.

Share the output returned by the last node

The last node (Discord) in Workflow 3 consistently returns the error message provided above.

Input received by the Discord node in Workflow 3 (from a live, failed WF2 execution):

JSON[ { "execution": { "id": "472", "url": "http://localhost:5678/workflow/AiB7RRWXHo6Z8j7v/executions/472", "error": { "level": "warning", "tags": {}, "timestamp": 1753370141822, "context": {}, "functionality": "regular", "name": "NodeOperationError", "node": { "parameters": { "errorType": "errorMessage", "errorMessage": "An error occured!" }, "type": "n8n-nodes-base.stopAndError", "typeVersion": 1, "position": [ 176, -160 ], "id": "f939dbe6-9236-4a3b-b8e2-ec55da5ad5a1", "name": "Stop and Error" }, "messages": [], "message": "An error occured!", "stack": "NodeOperationError: An error occured!\n\t at ExecuteContext.execute (...)\n..." }, "lastNodeExecuted": "Stop and Error", "mode": "trigger" }, "workflow": { "id": "AiB7RRWXHo6Z8j7v", "name": "Workflow 2" } } ]

Even though the actual input shows “Workflow 2”, the Discord node’s “Result” preview within the n8n UI consistently displays “Example Workflow”, which seems to be a UI-specific bug for Error Workflows.

Information on your n8n setup

  • n8n version: 1.103.2
  • Database (default: SQLite): SQLite (default)
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default (own, main)
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 10 home
2 Likes

Same error for me! Help Please!

This morning 10:25, it Works….

same step same error for me too. Please help with the fix. Thanks

Hey @Max_00, welcome to the community :waving_hand:

The problem here isn’t with Discord itself, it’s with how the error workflow data is structured. In your expression you’re calling:

{{ $json.execution.error.message }}

But in error workflows, the error details are nested a bit differently. The correct path is:

{{ $json.execution.error.message || "Unknown error" }}

And for other fields:

  • Workflow name → {{ $json.workflow.name }}

  • Last node executed → {{ $json.execution.lastNodeExecuted }}

  • Execution link → {{ $json.execution.url }}

So your Discord message should look like this:

The workflow {{ $json.workflow.name }} failed  
Error: {{ $json.execution.error.message || "Unknown error" }}  
Last node executed: {{ $json.execution.lastNodeExecuted }}  
Check execution: {{ $json.execution.url }}

This way, if the error object is missing or undefined, the message won’t crash — it’ll just say “Unknown error”.

That should stop the “Cannot read properties of undefined” error and let the Discord node send messages properly.

If this helped, please mark it as Solution so others with the same issue can find it :folded_hands:

1 Like

Thanks @OptaneAI - should i be using a locally hosted n8n? currently i am running n8n on hostinger and still getting the same error even after updating the suggestion of || (or condition). Thanks again!

1 Like

no, there might be something else breaking then.
Because of-course you can run n8n on hostinger VPS, even i’m on vps and there’s no difference in the operations between local and VPS hosted n8n.

1 Like

@OptaneAI - Agreed - I was able to send message for level 1 but not for level 2. i think a mixup with the discord webhooks - I see they are formatted differently for level 1 and 2.

following are the links -

level 1 - https://internal.users.n8n.cloud/webhook/course-level-1

level 2 - https://internal.users.n8n.cloud/webhook/discord-level2

did you get the same webhooks?

also how do i mark a post as solution? Thanks for all the help and support!

1 Like

Hello, I’m leasly and I’m starting to learn n8n. I’m having the same issue: with “Notifying the team” step for the course 1. I’m using this n8n version: 1.106.3 (Self Hosted). I think the Webhook URL I recieved by email doesn’t work. “Webhook URL: https://url.avanan.click/v2/r01/\___https://internal.users.n8n.cloud/webhook/course-level-1__\_……”I always get this error: “TypeError: Cannot read properties of undefined (reading ‘error’) at ExecuteContext.parseDiscordError (C:\Users\lesly.torres\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\nodes\Discord\v2\helpers\utils.ts:32:30) at ExecuteContext.execute (C:\Users\lesly.torres\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\nodes\Discord\v2\actions\webhook\sendLegacy.operation.ts:153:34) at processTicksAndRejections (node:internal/process/task_queues:105:5) at ExecuteContext.router (C:\Users\lesly.torres\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\nodes\Discord\v2\actions\router.ts:70:17) at ExecuteContext.execute (C:\Users\lesly.torres\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\nodes\Discord\v2\DiscordV2.node.ts:33:10) at WorkflowExecute.runNode (C:\Users\lesly.torres\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\workflow-execute.ts:1212:9) at C:\Users\lesly.torres\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\workflow-execute.ts:1582:27 at C:\Users\lesly.torres\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\workflow-execute.ts:2158:11”

I am following the course-level-2, in the error workflow(workflow3) I created my discord node is giving an error, “Cannot read properties of undefined (reading ‘error’)”. Even if I just try to send a plain text message, it gives the error. With same authentication two instances of the discord node works in the workflow2. Can someone please help me. ?

I’m consistently encountering the same issue when using the provided webhook for the course-level-2 channel. However, I didn’t have an issue when using the webhook for the course-level-1 channel. I have n8n v1.112.6 running locally as a docker image, which I used to follow both courses.

Note that I changed the message body as suggested by @OptaneAI in his response.

n8n version

1.112.6 (Self Hosted)

Stack trace

TypeError: Cannot read properties of undefined (reading 'error') at ExecuteContext.parseDiscordError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Discord/v2/helpers/utils.ts:32:30) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/webhook/sendLegacy.operation.ts:153:34) at processTicksAndRejections (node:internal/process/task_queues:105:5) at ExecuteContext.router (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Discord/v2/actions/router.ts:70:17) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_afd197edb2c1f848eae21a96a97fab23/node_modules/n8n-nodes-base/nodes/Discord/v2/DiscordV2.node.ts:33:10) at WorkflowExecute.executeNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1254:8) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1428:11) at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1761:27 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_08b575bec2313d5d8a4cc75358971443/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2338:11

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