openclaw - 💡(How to fix) Fix feishu: fetchQuotedMessage JSON parse error crashes entire message dispatch [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#60891Fetched 2026-04-08 02:46:03
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

When a user quotes a Feishu message that contains malformed card JSON (e.g. from a previous bot reply with invalid card content), fetchQuotedMessage throws a SyntaxError that is not caught. This exception propagates up and aborts the entire message dispatch pipeline, leaving the session stuck until the user sends a new message to re-activate it.

Error Message

When a user quotes a Feishu message that contains malformed card JSON (e.g. from a previous bot reply with invalid card content), fetchQuotedMessage throws a SyntaxError that is not caught. This exception propagates up and aborts the entire message dispatch pipeline, leaving the session stuck until the user sends a new message to re-activate it. elog.warn(feishu[${accountId}]: failed to parse quoted message card JSON, skipping quoted context, e.message);

Root Cause

When a user quotes a Feishu message that contains malformed card JSON (e.g. from a previous bot reply with invalid card content), fetchQuotedMessage throws a SyntaxError that is not caught. This exception propagates up and aborts the entire message dispatch pipeline, leaving the session stuck until the user sends a new message to re-activate it.

Fix Action

Fix / Workaround

Summary

When a user quotes a Feishu message that contains malformed card JSON (e.g. from a previous bot reply with invalid card content), fetchQuotedMessage throws a SyntaxError that is not caught. This exception propagates up and aborts the entire message dispatch pipeline, leaving the session stuck until the user sends a new message to re-activate it.

Steps to Reproduce

  1. Bot sends a reply containing a Feishu interactive card with malformed JSON content (e.g. an edits array with an empty {} element renders broken card content)
  2. User quotes that message in a follow-up reply
  3. Gateway fetches the quoted message via Feishu API and attempts JSON.parse() on the card content
  4. SyntaxError: Expected ',' or ']' after array element in JSON at position 2827 is thrown
  5. Message dispatch is aborted — no response is generated, session appears hung

Expected Behavior

fetchQuotedMessage should wrap JSON parsing in a try-catch. On parse failure, it should gracefully degrade — either return null/empty quoted context or return the raw text fallback — and allow message dispatch to continue normally.

Code Example

[feishu] feishu[jumboojp]: fetched quoted message: <card>
Expected ',' or ']' after array element in JSON at position 2827 (line 1 column 2828)

---

try {
  quotedContent = JSON.parse(rawCardContent);
} catch (e) {
  elog.warn(`feishu[${accountId}]: failed to parse quoted message card JSON, skipping quoted context`, e.message);
  quotedContent = null; // or fallback to raw text
}
RAW_BUFFERClick to expand / collapse

Bug Report

Summary

When a user quotes a Feishu message that contains malformed card JSON (e.g. from a previous bot reply with invalid card content), fetchQuotedMessage throws a SyntaxError that is not caught. This exception propagates up and aborts the entire message dispatch pipeline, leaving the session stuck until the user sends a new message to re-activate it.

Steps to Reproduce

  1. Bot sends a reply containing a Feishu interactive card with malformed JSON content (e.g. an edits array with an empty {} element renders broken card content)
  2. User quotes that message in a follow-up reply
  3. Gateway fetches the quoted message via Feishu API and attempts JSON.parse() on the card content
  4. SyntaxError: Expected ',' or ']' after array element in JSON at position 2827 is thrown
  5. Message dispatch is aborted — no response is generated, session appears hung

Observed Log

[feishu] feishu[jumboojp]: fetched quoted message: <card>
Expected ',' or ']' after array element in JSON at position 2827 (line 1 column 2828)

Expected Behavior

fetchQuotedMessage should wrap JSON parsing in a try-catch. On parse failure, it should gracefully degrade — either return null/empty quoted context or return the raw text fallback — and allow message dispatch to continue normally.

Suggested Fix

try {
  quotedContent = JSON.parse(rawCardContent);
} catch (e) {
  elog.warn(`feishu[${accountId}]: failed to parse quoted message card JSON, skipping quoted context`, e.message);
  quotedContent = null; // or fallback to raw text
}

Environment

  • OpenClaw version: 4.2
  • Channel: feishu (openclaw-lark plugin)
  • Platform: macOS Darwin arm64

Impact

High — any malformed quoted message permanently blocks the current user turn. User must send a new message to recover. This is especially disruptive in automated/cron workflows.

extent analysis

TL;DR

Wrap the JSON parsing in fetchQuotedMessage with a try-catch block to catch and handle SyntaxError exceptions, preventing the message dispatch pipeline from aborting.

Guidance

  • Identify the fetchQuotedMessage function and modify it to include a try-catch block around the JSON parsing code.
  • In the catch block, log a warning message with the error details and set the quotedContent to null or a raw text fallback to allow message dispatch to continue.
  • Verify that the modified function correctly handles malformed JSON content and does not abort the message dispatch pipeline.
  • Test the fix with different types of malformed JSON content to ensure it works as expected.

Example

try {
  quotedContent = JSON.parse(rawCardContent);
} catch (e) {
  console.warn(`Failed to parse quoted message card JSON, skipping quoted context: ${e.message}`);
  quotedContent = null; // or fallback to raw text
}

Notes

This fix assumes that the fetchQuotedMessage function is the only place where JSON parsing is done, and that wrapping it with a try-catch block will prevent the SyntaxError exception from propagating up and aborting the message dispatch pipeline.

Recommendation

Apply the suggested fix to wrap the JSON parsing in fetchQuotedMessage with a try-catch block, as it directly addresses the root cause of the issue and prevents the message dispatch pipeline from aborting.

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