openclaw - 💡(How to fix) Fix [Feishu] message --action send --filePath fails to send file attachments, returns link instead of actual file [4 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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#48857Fetched 2026-04-08 00:51:50
View on GitHub
Comments
4
Participants
4
Timeline
8
Reactions
0
Author
Timeline (top)
commented ×4subscribed ×2mentioned ×1renamed ×1

Error Message

throw new Error(Feishu ${ctx.action} requires text/message or card.);

Root Cause

🔍 Root Cause Analysis

Fix Action

Fix / Workaround

🔄 Workaround

Currently unable to send file attachments via message tool to Feishu. Workarounds:

  1. Manually copy and paste file content
  2. Use Feishu desktop client to send files manually

Code Example

message --action send --channel feishu --filePath /absolute/path/to/file.md --message "Test file"

---

if (ctx.action === "send" || ctx.action === "thread-reply") {
  const card = ctx.params.card && typeof ctx.params.card === "object" ? ... : undefined;
  const text = readFirstString(ctx.params, ["text", "message"]);
  if (!card && !text) {
    throw new Error(`Feishu ${ctx.action} requires text/message or card.`);
  }
  // ❌ Does not check media/filePath parameters
  const result = card
    ? await runtime.sendCardFeishu({...})
    : await runtime.sendMessageFeishu({...}); // Only sends text
}

---

// Add mediaUrl detection
const mediaUrl = readFirstString(ctx.params, ["media", "filePath", "path"]) ?? undefined;

if (mediaUrl) {
  // Call sendMediaFeishu to handle file upload and send
  const result = await runtime.sendMediaFeishu({
    cfg: ctx.cfg,
    to,
    mediaUrl,
    accountId: ctx.accountId ?? undefined,
    replyToMessageId,
  });
  return jsonActionResult({...});
}
RAW_BUFFERClick to expand / collapse

name: 🐛 Bug Report about: Create a report to help us improve title: "[Feishu] message --action send --filePath fails to send file attachments, returns link instead of actual file" labels: bug, channel:feishu

📋 Description

When using the message tool to send file attachments via Feishu (Lark) channel, the recipient receives a link like http://filename.md/ instead of an actual file attachment, making it impossible to view the file content.

🔍 Reproduction Steps

  1. Configure Feishu channel and start Gateway
  2. Send a file using message tool in a Feishu chat:
    message --action send --channel feishu --filePath /absolute/path/to/file.md --message "Test file"
  3. Recipient receives: 📎 [filename.md](http://filename.md/) - Test file
  4. Clicking the link fails (invalid URL)

✅ Expected Behavior

Recipient should receive an actual file attachment (.md file) that can be downloaded and opened, not an invalid link.

🔍 Root Cause Analysis

Location: extensions/feishu/src/channel.ts - handleAction function, send branch (around line 431)

Current Code:

if (ctx.action === "send" || ctx.action === "thread-reply") {
  const card = ctx.params.card && typeof ctx.params.card === "object" ? ... : undefined;
  const text = readFirstString(ctx.params, ["text", "message"]);
  if (!card && !text) {
    throw new Error(`Feishu ${ctx.action} requires text/message or card.`);
  }
  // ❌ Does not check media/filePath parameters
  const result = card
    ? await runtime.sendCardFeishu({...})
    : await runtime.sendMessageFeishu({...}); // Only sends text
}

Problem: The handleAction function only handles text/message and card parameters, but ignores media/filePath/path parameters.

Suggested Fix:

// Add mediaUrl detection
const mediaUrl = readFirstString(ctx.params, ["media", "filePath", "path"]) ?? undefined;

if (mediaUrl) {
  // Call sendMediaFeishu to handle file upload and send
  const result = await runtime.sendMediaFeishu({
    cfg: ctx.cfg,
    to,
    mediaUrl,
    accountId: ctx.accountId ?? undefined,
    replyToMessageId,
  });
  return jsonActionResult({...});
}

📊 Environment

  • OpenClaw Version: 2026.3.14
  • Node Version: v24.14.0
  • OS: macOS 25.3.0 (arm64)
  • Channel: Feishu (Lark)
  • Config: Single account, default configuration

🔄 Workaround

Currently unable to send file attachments via message tool to Feishu. Workarounds:

  1. Manually copy and paste file content
  2. Use Feishu desktop client to send files manually

📝 Additional Context

This issue affects all scenarios requiring file attachments via Feishu channel:

  • Sending documents (.md, .txt, .pdf, etc.)
  • Sending code files
  • Sending any type of attachment

Would appreciate an official fix. Thanks! 🙏

extent analysis

Fix Plan

To fix the issue of the message tool failing to send file attachments via Feishu channel, we need to modify the handleAction function in extensions/feishu/src/channel.ts to handle media/filePath/path parameters.

Step-by-Step Solution:

  1. Update the handleAction function to detect mediaUrl:

if (ctx.action === "send" || ctx.action === "thread-reply") { const card = ctx.params.card && typeof ctx.params.card === "object" ? ... : undefined; const text = readFirstString(ctx.params, ["text", "message"]); const mediaUrl = readFirstString(ctx.params, ["media", "filePath", "path"]) ?? undefined;

if (!card && !text && !mediaUrl) { throw new Error(Feishu ${ctx.action} requires text/message, card, or media.); }

if (mediaUrl) { // Call sendMediaFeishu to handle file upload and send const result = await runtime.sendMediaFeishu({ cfg: ctx.cfg, to, mediaUrl, accountId: ctx.accountId ?? undefined, replyToMessageId, }); return jsonActionResult({...}); } else { const result = card ? await runtime.sendCardFeishu({...}) : await runtime.sendMessageFeishu({...}); } }

2. **Ensure `sendMediaFeishu` function is implemented** to handle file uploads and sending.

### Verification
To verify the fix, follow these steps:
* Configure the Feishu channel and start the Gateway.
* Send a file using the `message` tool in a Feishu chat:
  ```bash
message --action send --channel feishu --filePath /absolute/path/to/file.md --message "Test file"
  • The recipient should receive an actual file attachment (.md file) that can be downloaded and opened.

Extra Tips

  • Make sure to test the fix with different file types to ensure compatibility.
  • Consider adding error handling for cases where file uploads fail.
  • Review the sendMediaFeishu function implementation to ensure it correctly handles file uploads and sending.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING