openclaw - 💡(How to fix) Fix message send returns exit 0 even on failure; --dry-run silently ignored [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#70977Fetched 2026-04-24 10:37:12
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

Error: Request entity too large exit=0

Code Example

docker exec openclaw-gateway openclaw message send \
  --channel discord --target channel:<channel-id> \
  --message "preflight test" \
  --dry-run

---

docker exec openclaw-gateway openclaw message send \
  --channel discord --target channel:<channel-id> \
  --message "test" \
  --media /home/node/.openclaw/workspace/news-audio/<41MB-wav>
echo "exit=$?"

---

Error: Request entity too large
exit=0

---

def _run(cmd: list[str]) -> str:
    proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
    combined = (proc.stdout + "\n" + proc.stderr).strip()
    if proc.returncode != 0 or ("Error:" in combined and "Message ID" not in combined):
        raise RuntimeError(f"send failed (rc={proc.returncode}): {combined}")
    return proc.stdout.strip()
RAW_BUFFERClick to expand / collapse

OpenClaw CLI: message send returns exit code 0 even on failure; --dry-run flag silently ignored

Version: OpenClaw 2026.4.21 Platform: QNAP TS-464(Container Station)+ ghcr.io/openclaw/openclaw:latest Channel: Discord(再現は他 channel でも発生する可能性あり)

概要

openclaw message send CLI が以下 2 つの silent-fail パターンを示し、スクリプトからの呼び出しで「成功」と誤判定されるケースがあります。本番運用で Discord 投稿が届かない事象が発生し、原因調査に数時間を要しました。

Bug 1: --dry-run が効かず実送信される

再現手順

docker exec openclaw-gateway openclaw message send \
  --channel discord --target channel:<channel-id> \
  --message "preflight test" \
  --dry-run

期待

--dry-run により、ペイロードを表示するのみで実送信されない(help にも「Print payload and skip sending」と記載)。

実際

通常の送信と同様に stdout に ✅ Sent via Discord. Message ID: <snowflake> が表示され、Discord に実投稿される

影響

テスト・疎通確認目的のスクリプトが誤って本番チャネルに投稿してしまう。


Bug 2: 送信失敗時も exit code 0 を返す

再現手順(Discord 添付サイズ超過の例)

docker exec openclaw-gateway openclaw message send \
  --channel discord --target channel:<channel-id> \
  --message "test" \
  --media /home/node/.openclaw/workspace/news-audio/<41MB-wav>
echo "exit=$?"

期待

送信失敗時(Discord 無料 bot の 10 MiB 上限超過、ネットワークエラー等)は exit code を非 0 にしてスクリプトから検知可能にする。

実際

Error: Request entity too large
exit=0

stdout に Error: ... が出るが、exit code は 0 のため Python / bash の条件分岐で成否判定できない。

影響

  • subprocess.run(cmd, check=True) スタイルの呼び出しが成功扱いになる
  • wrapper 側で stdout/stderr の文字列検査(grep "Error:""Message ID:" の有無)が必須になる
  • 本事案では news-morning-brief skill で Discord 投稿が届かない状態が数時間 silent で続いた

wrapper 回避策(参考)

def _run(cmd: list[str]) -> str:
    proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
    combined = (proc.stdout + "\n" + proc.stderr).strip()
    if proc.returncode != 0 or ("Error:" in combined and "Message ID" not in combined):
        raise RuntimeError(f"send failed (rc={proc.returncode}): {combined}")
    return proc.stdout.strip()

提案

  1. --dry-run フラグを実装通りに動作させる(実送信をスキップ)
  2. 送信失敗時は exit code を非 0 にする(少なくとも Error: を stdout に出しているケース)
  3. 可能なら JSON output mode を追加(--json{"status": "error|ok", "messageId": ..., "error": ...} 形式)

環境

  • OpenClaw: 2026.4.21(container image ghcr.io/openclaw/openclaw:latest、起動 2026-04-24)
  • Node ランタイム: 24.14.0(_meta.runtimeVersion より)
  • Discord bot: @Tars、通常 bot(Nitro 無し)
  • 呼び出し元: QNAP host cron → docker compose run → Python 3.12 コンテナ → docker exec openclaw-gateway openclaw message send

関連

  • 本 Issue と独立に、コンテナ内 log 出力には openclaw message send の呼び出し結果が来ない(docker logs openclaw-gateway には出ないが、内部 log file /tmp/openclaw/openclaw-YYYY-MM-DD.log には Message ID が記録される)。デバッグ時に混乱した

extent analysis

TL;DR

The OpenClaw CLI message send command should be modified to correctly implement the --dry-run flag and return a non-zero exit code on failure.

Guidance

  • Verify the current behavior of the --dry-run flag by running the command with the flag and checking if the message is sent to Discord.
  • Check the exit code of the command after a failed send operation to confirm it returns 0.
  • Consider implementing a wrapper function like the provided Python example to handle the current limitations of the openclaw message send command.
  • Test the proposed changes to ensure the --dry-run flag is correctly implemented and the exit code is non-zero on failure.

Example

The provided Python wrapper function can be used as a temporary workaround:

def _run(cmd: list[str]) -> str:
    proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
    combined = (proc.stdout + "\n" + proc.stderr).strip()
    if proc.returncode != 0 or ("Error:" in combined and "Message ID" not in combined):
        raise RuntimeError(f"send failed (rc={proc.returncode}): {combined}")
    return proc.stdout.strip()

Notes

The proposed changes require modifications to the OpenClaw CLI code, which may take time to implement and release. The provided wrapper function can be used as a temporary workaround to handle the current limitations.

Recommendation

Apply the proposed changes to the OpenClaw CLI code to correctly implement the --dry-run flag and return a non-zero exit code on failure, as this will provide a more robust and reliable solution.

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

openclaw - 💡(How to fix) Fix message send returns exit 0 even on failure; --dry-run silently ignored [1 participants]