Discord 'send a message' node not working

Describe the problem/error/question

Discord node not functioning right; AI Agent output does not go through it and it fails to execute

What is the error message (if any)?

Cannot read properties of undefined (reading 'error')

Please share your workflow

Share the output returned by the last node

N/A. Same error message

Information on your n8n setup

  • n8n version: 1.114.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Podman (Docker, but undercomplicated)
  • Operating system: Fedora Silverblue 42

FYI, NO, this is not the Level 2 challenge thing, or whatever. This is a solo thing. All other Discord messaging nodes work with no problems, and this is the only one that’s broken

Is the agent working? I can see a error message from your gemini model. What exactly works and what not?

The agent works. It just can’t send messages to Discord, though. That’s the problem!

  1. Click the AI Agent node.

  2. Go to the “Execution Data” tab.

  3. Check what it actually outputs under json.

    You should see something like:

    {
      "output": "Hello there!"
    }
    
    

    If instead you see:

    {
      "data": { "text": "Hello there!" }
    }
    
    

    then your Discord node must reference it accordingly:

    {{$json["data"]["text"]}}
    
    

    As a safeguard, you can insert a Set node between your AI Agent and Discord node:

    • Set it to keep only specific fields.

    • Rename the output cleanly (e.g. message = {{$json["output"]}}).

    Then in Discord:

    {{$json["message"]}}
    
    

    This ensures the structure is always consistent.

Despite everything, it still doesn’t work.

{
  "Message": "Fake message; ignore this message"
}

This is what the JSON looks like, but it still fails.

Step 1: Minimal Test (Is Discord Node Working?)

Create a new temporary workflow with only these two nodes:

  1. Set Node
    • Add a field:
      • Name: Message
      • Value: Test message from n8n
  2. Discord Node
    • Channel: your test channel
    • Message:
      {{$json[“Message”]}}

Run this test.

If this fails → the Discord node itself (credentials, permissions, or setup) is the issue.
If this succeeds → the problem lies with how data is passed from your AI Agent node.

Step 2: Check the Discord Node Configuration

Common pitfalls:

  • Wrong “Send To” type (must be Channel or User, not empty)
  • Missing or invalid credentials — try re-selecting your Discord credentials
  • n8n Discord node bug — occasionally happens; restarting n8n or re-saving the node fixes it

Step 3: Test with Chat Node (Optional but Good)

If Step 1 succeeds, connect a Chat node (e.g., OpenAI, Gemini, or local AI node) → Discord node,
and set the Discord message to:
{{$json[“text”] || $json[“output”] || $json[“Message”] || “No content”}}
This ensures you handle any of the possible field names your agent might return.

Step 4: Ensure Correct Data Propagation

Your example JSON:
{
“Message”: “Fake message; ignore this message”
}

works only if the Discord node’s Message field uses the exact key (case-sensitive):
{{$json[“Message”]}}

If you accidentally wrote:
{{$json[“message”]}}

(lowercase “m”), it will be undefined, resulting in the error you’re seeing.

1 Like

All along it was the character limit. Should’ve realized that earlier. Thanks again, though!

2 Likes

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