openclaw - ✅(Solved) Fix Feishu channel: empty text messages cause 'messages must not be empty' error with MiniMax provider [2 pull requests, 1 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#74634Fetched 2026-04-30 06:21:52
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2referenced ×2closed ×1

Error Message

``` 2026-04-30T05:27:39.784+08:00 [agent/embedded] embedded run agent end: runId=cc2e2c33-... isError=true model=MiniMax-M2.7-highspeed provider=minimax-portal error=LLM request rejected: invalid params, messages must not be empty (2013) 2026-04-30T02:26:46.318+08:00 [agent/embedded] session file repaired: rewrote 1 assistant message(s), dropped 1 blank user message(s) (819db0af-...) ```

Root Cause

File: dist/extensions/feishu/monitor.account-PVyhNwIK.js, line 92:

function parseMessageContent(content, messageType) {
  if (messageType === \"text\") return parsed.text || \"\";  // ← returns \"\" for empty text
  // ...
}

The empty string flows through handleFeishuMessagebuildFeishuAgentBody → session write → LLM request, with no guard at any layer.

Fix Action

Fixed

PR fix notes

PR #74661: fix(feishu): skip empty-text messages with no media to prevent blank session turns (#74634)

Description (problem / solution / changelog)

What

Feishu delivers {"text":""} events when users send blank text messages or when the SDK produces empty content for certain message types. Writing a blank user turn to the session file causes downstream LLM providers to reject requests:

invalid params, messages must not be empty (2013)   ← MiniMax

Fix

After media list resolution, guard before queuing the reply: if ctx.content.trim() is empty and mediaList.length === 0, log the skip and return without dispatching. Messages with media (image, audio, video, file) continue to work normally — they always produce non-empty mediaList regardless of ctx.content.

extensions/feishu/src/bot.ts  — early-return guard after resolveFeishuMediaList
extensions/feishu/src/bot.test.ts  — regression test: empty-text DM → not dispatched
CHANGELOG.md  — entry with @xdengli attribution

Test

pnpm test extensions/feishu/src/bot.test.ts

58/58 pass, including new test: skips empty-text messages with no media to prevent blank user turns in session (#74634).

Pre-implement audit

  • Existing-helper check: No existing empty-content guard anywhere in handleFeishuMessage. PASS.
  • Shared-helper caller check: handleFeishuMessage is a top-level event handler, not a shared helper. PASS.
  • Broader-fix rival scan: No rival PRs for #74634. PASS.

Closes #74634. Thanks @xdengli.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • extensions/feishu/src/bot.test.ts (modified, +38/-0)
  • extensions/feishu/src/bot.ts (modified, +13/-0)

PR #74717: fix(feishu): skip empty text messages to avoid downstream LLM 'messages must not be empty' (#74634)

Description (problem / solution / changelog)

Summary

Fixes #74634.

When a Feishu user sends a message whose text payload is empty ({"text": ""} or a media-only message that resolves to no content), parseMessageContent returned an empty string and the empty ctx.content flowed all the way through handleFeishuMessage into the session transcript. The next LLM request then failed with errors like messages must not be empty (2013) on MiniMax, forcing fallback failovers and noisy gateway error logs.

Fix

Add an early guard in handleFeishuMessage (extensions/feishu/src/bot.ts): for message_type === "text" with no trimmed content, log and return before any agent route resolution or session write happens. This matches the suggested fix in the issue and is the narrowest layer that still keeps richer-content messages (post / media / share_chat / merge_forward) untouched.

Test

Added extensions/feishu/src/bot.test.ts case "skips empty text messages without invoking the agent route resolver" that dispatches an empty-text payload through handleFeishuMessage and asserts neither resolveAgentRoute nor sendMessageFeishu is invoked.

✓ extensions/feishu/src/bot.test.ts (58 tests) 700ms
Test Files  1 passed (1)
     Tests  58 passed (58)

Notes

  • Non-text messages (image/file/audio/video/sticker/post/share_chat/merge_forward) are unaffected — the guard is gated on message_type === "text".
  • A user-visible reply is intentionally not sent for empty text events; the original message is just dropped (matches the issue's "skip entirely" suggestion).

Changed files

  • extensions/feishu/src/bot.test.ts (modified, +22/-0)
  • extensions/feishu/src/bot.ts (modified, +11/-0)

Code Example

{ \"role\": \"user\", \"content\": \"\" }

---

invalid params, messages must not be empty (2013)

---

function parseMessageContent(content, messageType) {
  if (messageType === \"text\") return parsed.text || \"\";  // ← returns \"\" for empty text
  // ...
}

---

// Skip empty messages (no text content, no media)
if (!ctx.content.trim() && mediaList.length === 0) {
  log(\`feishu: skipping empty message from \${ctx.senderOpenId}\`);
  return;
}
RAW_BUFFERClick to expand / collapse

Bug Description

When a Feishu user sends a message with empty text content (e.g., {\"text\": \"\"} or a media-only message), the Feishu channel writes a blank user message to the session file:

{ \"role\": \"user\", \"content\": \"\" }

When this session is used in a subsequent LLM request to MiniMax (the default provider), MiniMax rejects the request with:

invalid params, messages must not be empty (2013)

This causes an automatic failover to deepseek-chat, but the MiniMax error still appears in logs for every affected session startup.

Steps to Reproduce

  1. Have a Feishu channel configured with MiniMax as the default model
  2. Send an empty text message or media-only message through Feishu
  3. Observe the error in gateway.err.log

Expected Behavior

Empty-content messages from Feishu should either:

  • Be skipped entirely (not written to session)
  • Or be replaced with a placeholder like "[Empty message]"

Root Cause

File: dist/extensions/feishu/monitor.account-PVyhNwIK.js, line 92:

function parseMessageContent(content, messageType) {
  if (messageType === \"text\") return parsed.text || \"\";  // ← returns \"\" for empty text
  // ...
}

The empty string flows through handleFeishuMessagebuildFeishuAgentBody → session write → LLM request, with no guard at any layer.

Suggested Fix

In handleFeishuMessage, after parseFeishuMessageEvent() and before writing to session, add a guard:

// Skip empty messages (no text content, no media)
if (!ctx.content.trim() && mediaList.length === 0) {
  log(\`feishu: skipping empty message from \${ctx.senderOpenId}\`);
  return;
}

Alternatively, add a guard in parseMessageContent to return a placeholder for empty content.

Environment

  • OpenClaw version: 2026.4.2
  • Feishu channel: enabled
  • Default model: minimax-portal/MiniMax-M2.7-highspeed
  • Frequency: ~40 occurrences over 3 days (4/28–4/30)

Logs

``` 2026-04-30T05:27:39.784+08:00 [agent/embedded] embedded run agent end: runId=cc2e2c33-... isError=true model=MiniMax-M2.7-highspeed provider=minimax-portal error=LLM request rejected: invalid params, messages must not be empty (2013) 2026-04-30T02:26:46.318+08:00 [agent/embedded] session file repaired: rewrote 1 assistant message(s), dropped 1 blank user message(s) (819db0af-...) ```

extent analysis

TL;DR

Add a guard in handleFeishuMessage to skip empty messages or return a placeholder for empty content to prevent MiniMax errors.

Guidance

  • Verify the issue by checking the session file for blank user messages and the gateway error logs for the "invalid params" error.
  • Implement the suggested fix by adding a guard in handleFeishuMessage to skip empty messages or return a placeholder for empty content.
  • Consider adding a similar guard in parseMessageContent to handle empty content at an earlier stage.
  • Review the logs to ensure the error is resolved and the session files are correctly updated.

Example

// Skip empty messages (no text content, no media)
if (!ctx.content.trim() && mediaList.length === 0) {
  log(`feishu: skipping empty message from ${ctx.senderOpenId}`);
  return;
}

Notes

The suggested fix assumes that the issue is caused by the empty string being passed through to the LLM request. If the issue persists after implementing the fix, further investigation may be needed to identify the root cause.

Recommendation

Apply the workaround by adding a guard in handleFeishuMessage to skip empty messages or return a placeholder for empty content, as this is a targeted fix for the identified 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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING