openclaw - ✅(Solved) Fix [Bug]: openclaw message send --media not working from CLI (WhatsApp) [1 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#63461Fetched 2026-04-09 07:53:29
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1subscribed ×1

Bug report: openclaw message send --media not working from CLI (WhatsApp)

Version: 2026.4.8

Description: When using openclaw message send --channel whatsapp --media /path/to/file.ogg -m "text" from the terminal, the message is sent but without the media attachment (hasMedia: false in logs). The command reports success and returns a Message ID, but only the text arrives.

Root Cause

Root cause (from source inspection): The agent runtime calls saveMediaSource() before sending, which properly processes the file. The CLI does not call this step — it passes the path directly to the gateway via WebSocket, which then ignores it.

Fix Action

Fix / Workaround

Workaround: None from CLI. Works when triggered internally by the agent.

PR fix notes

PR #63479: fix(cli): stage local media before gateway send #63461

Description (problem / solution / changelog)

Summary

  • Problem: openclaw message send --channel whatsapp --media <path> reported success but only text was delivered (hasMedia: false), because WhatsApp outbound uses deliveryMode: "gateway" and the CLI only sent raw filesystem path strings over the gateway RPC. The gateway only reads local media under agent-scoped roots; arbitrary paths (e.g. under home or /tmp) were not loadable.
  • Why it matters: Users expect CLI sends to behave like agent-driven sends, which persist media via saveMediaSource into managed storage first.
  • What changed: Before callMessageGateway for send, local paths outside allowed roots are copied with saveMediaSource(..., "outbound") on the CLI host; http(s) and opaque refs (e.g. media:) are unchanged; paths already under getAgentScopedMediaLocalRoots are not duplicated. New helper: src/infra/outbound/message-gateway-media.ts; wired from src/infra/outbound/message.ts. Tests in src/infra/outbound/message-gateway-media.test.ts.
  • What did NOT change (scope boundary): Gateway wire protocol, WhatsApp plugin outbound adapter, remote-gateway / cross-machine file transfer (still path-string only over RPC).

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Fixes #63461 Related #51347

User-visible / Behavior Changes

  • CLI message send for channels whose outbound uses gateway delivery (including WhatsApp) now stages out-of-root local --media paths into the managed media directory before invoking the gateway, so attachments can be read and sent when CLI and gateway run on the same host with a normal filesystem.

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No (same CLI flags; behavior for valid sends improves)
  • Data access scope changed? No (still reads only user-supplied paths; staging uses existing saveMediaSource / size limits)

Repro + Verification

Environment

  • OS: Linux (dev); behavior intended same on macOS/Windows for local gateway
  • Runtime: Node 22+
  • Channel: WhatsApp (gateway delivery mode)

Steps

  1. Place a media file outside default media roots (e.g. under home or a non–OpenClaw tmp path).
  2. Run: openclaw message send --channel whatsapp --target <jid-or-e164> --media /path/to/file -m "test" (with gateway running locally as usual for your setup).

Expected

  • Message delivers with media attachment (not text-only).

Actual (before fix)

  • Text delivered; logs showed no effective media / hasMedia: false style behavior for disallowed paths.

Evidence

  • Unit tests: pnpm test src/infra/outbound/message-gateway-media.test.ts (and src/infra/outbound/message.test.ts as part of local gate)

Human Verification (required)

  • Verified scenarios: Logic review + unit tests for staging vs pass-through vs in-root paths.
  • Edge cases checked: HTTPS passthrough; Windows drive paths not misclassified as opaque schemes (code path).
  • What I did not verify: End-to-end WhatsApp Web send with real account (requires live gateway + WhatsApp session).

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery (if this breaks)

  • Revert the commit touching src/infra/outbound/message.ts and remove message-gateway-media.ts / test file.

Risks and Mitigations

  • Risk: Extra disk write and brief copy for large files within existing media size limits.
    • Mitigation: Same saveMediaSource path as other tooling; skips copy when already under allowed roots.

Changed files

  • src/infra/outbound/message-gateway-media.test.ts (added, +85/-0)
  • src/infra/outbound/message-gateway-media.ts (added, +118/-0)
  • src/infra/outbound/message.ts (modified, +15/-4)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Bug report: openclaw message send --media not working from CLI (WhatsApp)

Version: 2026.4.8

Description: When using openclaw message send --channel whatsapp --media /path/to/file.ogg -m "text" from the terminal, the message is sent but without the media attachment (hasMedia: false in logs). The command reports success and returns a Message ID, but only the text arrives.

Steps to reproduce

openclaw message send --channel whatsapp --target +34XXXXXXXXX --media /absolute/path/audio.ogg -m "test"

Expected: Message + audio arrive Actual: Only text arrives, hasMedia: false in gateway log

Root cause (from source inspection): The agent runtime calls saveMediaSource() before sending, which properly processes the file. The CLI does not call this step — it passes the path directly to the gateway via WebSocket, which then ignores it.

Workaround: None from CLI. Works when triggered internally by the agent.

Expected behavior

Root cause (from source inspection): The agent runtime calls saveMediaSource() before sending, which properly processes the file. The CLI does not call this step — it passes the path directly to the gateway via WebSocket, which then ignores it.

Actual behavior

Root cause (from source inspection): The agent runtime calls saveMediaSource() before sending, which properly processes the file. The CLI does not call this step — it passes the path directly to the gateway via WebSocket, which then ignores it.

OpenClaw version

2026.4.8

Operating system

Debian 13

Install method

npm global

Model

anthropic/claude 4.6

Provider / routing chain

openclaw / anthropic

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Gravedad baja Impacto ejecucion manual gateway whatsapp

Additional information

No response

extent analysis

TL;DR

The most likely fix is to modify the CLI to call saveMediaSource() before sending the media file, similar to the agent runtime.

Guidance

  • The root cause is that the CLI does not call saveMediaSource() before sending the media file, which is necessary for proper processing.
  • To verify the issue, check the gateway logs for hasMedia: false and confirm that the media file is not being sent.
  • A potential workaround could be to trigger the media send internally by the agent, as this is reported to work.
  • The CLI code needs to be updated to include the saveMediaSource() call before passing the media path to the gateway.

Example

No code example can be provided without more context, but the fix would involve adding a call to saveMediaSource() in the CLI code before sending the media file.

Notes

The provided information does not include the exact code or implementation details, so the suggested fix is based on the described root cause and may require additional modifications.

Recommendation

Apply workaround: Trigger the media send internally by the agent, as this is reported to work, until the CLI code can be updated to include the necessary saveMediaSource() call.

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

Root cause (from source inspection): The agent runtime calls saveMediaSource() before sending, which properly processes the file. The CLI does not call this step — it passes the path directly to the gateway via WebSocket, which then ignores it.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING