openclaw - ✅(Solved) Fix [Bug]: models struggle to use discord tool/skill for sending discord DM's because of target requiring "user:" prefix [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#72401Fetched 2026-04-27 05:30:28
View on GitHub
Comments
0
Participants
1
Timeline
6
Reactions
0
Author
Participants
Timeline (top)
referenced ×3labeled ×2cross-referenced ×1

Many models struggle and have to retry several times to send a DM to a discord user via the message tool

Error Message

"output": "{\n "status": "error",\n "tool": "message",\n "error": "Unknown Channel"\n}" "output": "{\n "status": "error",\n "tool": "message",\n "error": "Unknown Channel"\n}" "output": "{\n "status": "error",\n "tool": "message",\n "error": "Unknown Channel"\n}" "output": "{\n "status": "error",\n "tool": "message",\n "error": "guildId required"\n}" "output": "{\n "status": "error",\n "tool": "message",\n "error": "guildId required"\n}" "output": "{\n "status": "error",\n "tool": "message",\n "error": "Unknown target \"gary\" for Discord. Hint: <channelId|user:ID|channel:ID>"\n}"

Root Cause

Many models struggle and have to retry several times to send a DM to a discord user via the message tool

Fix Action

Fixed

PR fix notes

PR #72423: fix(channels): document Discord/Slack user:ID|channel:ID target syntax in tool description (#72401)

Description (problem / solution / changelog)

Fixes #72401.

Summary

The message tool's shared target parameter description currently reads:

Recipient/channel: E.164 for WhatsApp/Signal, Telegram chat id/@username, Discord/Slack channel/user, or iMessage handle/chat_id

"Discord/Slack channel/user" is ambiguous: the actual accepted shape is `<channelId|user:ID|channel:ID>`. Field reports (#72401) show that without the explicit format hint, models burn 4-5+ iterations on `Unknown Channel` / `guildId required` errors before stumbling on `target: "user:<id>"` — and weaker / non-reasoning models sometimes give up entirely.

The runtime error message already names the correct format (`Hint: <channelId|user:ID|channel:ID>` — see `extensions/discord/src/channel.ts:408`, `extensions/slack/src/channel.ts:413`, `extensions/mattermost/src/channel.ts:321`). This PR surfaces the same hint in the upfront tool description so models emit the correct shape on the first call.

Fix

Single-line update to the shared `CHANNEL_TARGET_DESCRIPTION` in `src/infra/outbound/channel-target.ts`. Changed:

"Discord/Slack channel/user"

to:

"Discord/Slack/Mattermost <channelId|user:ID|channel:ID>"

The constant is shared between the agent tool schema (`message-tool.ts`) and the CLI `--target` help text (`cli/program/message/helpers.ts`, `register.broadcast.ts`), so both surfaces benefit.

Tests

No tests assert the literal description string. Targeted tests all pass:

``` Test Files 3 passed (channel-target.test.ts: 6, channel-selection.test.ts: 15, message-tool.test.ts: 32) ```

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/tools/message-tool.ts (modified, +1/-1)
  • src/infra/outbound/channel-target.ts (modified, +1/-1)

Code Example

This is the log portion attached above:

    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "563134939021967380",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "channel": "discord",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHgXBXiyQmRUsf15AgV+8KEqAuTXJGRBCqSIuhidRFMuiwuoWnbFVfs+YowZTk"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown Channel\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "563134939021967380",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHXXp0gTnSAhL8i0vbxQsG7uonistCTIh4nEuq/zhoCvKIoGhZH31jngJ0rAP0"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown Channel\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "563134939021967380",
              "action": "channel-info"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbH02phx7GD3ymcq66A6sw2x8Z70JqEWNRPLv7H929myFj8DhcXM9kU298HhY2G"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown Channel\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "action": "channel-list"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHv7UKPSu0eBofb79o3Eq/+VfesfxBx+yOLIQNsLwDsLyFLG8L202qkQeCo5Qt"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"guildId required\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "userId": "563134939021967380",
              "action": "member-info"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHNx45jjDK5p68FA4bgLEzl2mqH7s8BMz3uHeJQ1boteTw94z0tak/KDI3a/RQ"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"guildId required\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "gary",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHlTImHOPpM6gtcbYYJ8dSx3RHn+HKStoI+zMAIBcJRILyviOrHjEX5F3iN0RS"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown target \\\"gary\\\" for Discord. Hint: <channelId|user:ID|channel:ID>\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "user:563134939021967380",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHCI5UizI0p3gE8LyHYCgBJXA+n0UaDKin1pgPDr/N3zPiiBLHwODzos4205Va"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"ok\": true,\n  \"result\": {\n    \"messageId\": \"1498077175104929922\",\n    \"channelId\": \"1496512854722084915\"\n  }\n}"
            }
          }
        }
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Many models struggle and have to retry several times to send a DM to a discord user via the message tool

Steps to reproduce

1, A virgin OpenClaw 2026.4.22 (using only prepackaged AGENTS, TOOLS, etc) 2. Tested with gpt-5.4-mini and gemini-3-flash-preview 3. Using webchat, "in 2 minutes, send a DM to discord user XXXXX with the current weather"

// XXXX is a discord user id. You can replace "current weather" with whatever.

Expected behavior

The model retrieves the information to send, and then generates a functionCall to message with the "target" argument set to "user:XXXXXX" (where XXXXX is the specified discord user id.)

Actual behavior

The model retrieves the information to send, and then generates a functionCall to message with the "target" argument set to "XXXXXX" (where XXXXX is the specified discord user id.)

NOTE THE MISSING 'user:' prefix

Depending on the model, it can take many tries before the model figures out how to properly format the target argument. I've noticed that gpt-5.4-mini usually figures it out in 4-5 iterations. gemini-3-flash can take MANY more iterations and trying of random things. I've attached a text file showing a portion of a gemini response log while it tries to figure out how to use the message tool.

openclaw-discord-follies.txt

OpenClaw version

2026.4.22

Operating system

Debian trixie

Install method

install.sh script

Model

gpt-5.4-mini or gemini-3-flash-preview

Provider / routing chain

I don't understand. OpenClaw is configured to use each model directly.

Additional provider/model setup details

No response

Logs, screenshots, and evidence

This is the log portion attached above:

    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "563134939021967380",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "channel": "discord",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHgXBXiyQmRUsf15AgV+8KEqAuTXJGRBCqSIuhidRFMuiwuoWnbFVfs+YowZTk"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown Channel\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "563134939021967380",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHXXp0gTnSAhL8i0vbxQsG7uonistCTIh4nEuq/zhoCvKIoGhZH31jngJ0rAP0"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown Channel\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "563134939021967380",
              "action": "channel-info"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbH02phx7GD3ymcq66A6sw2x8Z70JqEWNRPLv7H929myFj8DhcXM9kU298HhY2G"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown Channel\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "action": "channel-list"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHv7UKPSu0eBofb79o3Eq/+VfesfxBx+yOLIQNsLwDsLyFLG8L202qkQeCo5Qt"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"guildId required\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "userId": "563134939021967380",
              "action": "member-info"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHNx45jjDK5p68FA4bgLEzl2mqH7s8BMz3uHeJQ1boteTw94z0tak/KDI3a/RQ"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"guildId required\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "gary",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHlTImHOPpM6gtcbYYJ8dSx3RHn+HKStoI+zMAIBcJRILyviOrHjEX5F3iN0RS"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"status\": \"error\",\n  \"tool\": \"message\",\n  \"error\": \"Unknown target \\\"gary\\\" for Discord. Hint: <channelId|user:ID|channel:ID>\"\n}"
            }
          }
        }
      ],
      "role": "user"
    },
    {
      "parts": [
        {
          "functionCall": {
            "name": "message",
            "args": {
              "target": "user:563134939021967380",
              "message": "Hey Gary! Here's the current weather in Tarentum, PA:\n\ntarentum,pa: ⛅ +58°F (feels like +57°F), ↙7mph wind, 60% humidity, 0.0in precip (Source: wttr.in)",
              "action": "send"
            }
          },
          "thoughtSignature": "EjQKMgEMOdbHCI5UizI0p3gE8LyHYCgBJXA+n0UaDKin1pgPDr/N3zPiiBLHwODzos4205Va"
        }
      ],
      "role": "model"
    },
    {
      "parts": [
        {
          "functionResponse": {
            "name": "message",
            "response": {
              "output": "{\n  \"ok\": true,\n  \"result\": {\n    \"messageId\": \"1498077175104929922\",\n    \"channelId\": \"1496512854722084915\"\n  }\n}"
            }
          }
        }

Impact and severity

Affected: at least users who want discord DM's from cron. It might impact other aspects (such as webchat, etc.) Severity: Annoying, but I found an easy work-around (see Additional Information) Frequency: 100% repeatable Consequence: Can cause excess token usage while the model reasons out the proper argument, or message loss if the model gives up.

Additional information

There is a work-around I found. While I don't know if this is the correct place to put it, I added the following line to my TOOLS.md which seems to fix things:

When sending a DM via discord, the "to" parameter should have the string "user:" prepended to the user ID.

(Is there a better place for this?)

extent analysis

TL;DR

The issue can be fixed by prepending "user:" to the Discord user ID in the "target" argument of the message function.

Guidance

  • The root cause of the issue is the missing "user:" prefix in the "target" argument, which is required for sending DMs to Discord users.
  • To fix the issue, update the code to prepend "user:" to the Discord user ID in the "target" argument, as mentioned in the Additional Information section.
  • Verify the fix by testing the message function with the updated "target" argument and checking if the DM is sent successfully.
  • Consider updating the documentation or configuration files to reflect the correct format for the "target" argument to avoid similar issues in the future.

Example

No code example is provided as the issue is related to a specific configuration or documentation update.

Notes

The provided workaround seems to be a correct solution, but it's unclear if this is the only place where the update is needed. Further investigation may be required to ensure that all relevant code paths are updated.

Recommendation

Apply the workaround by prepending "user:" to the Discord user ID in the "target" argument, as this has been confirmed to fix the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The model retrieves the information to send, and then generates a functionCall to message with the "target" argument set to "user:XXXXXX" (where XXXXX is the specified discord user id.)

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING