Skip to content

[Bug]: LocalMediaAccessError when sending media files in local workspace via WhatsApp extension plugin #23140

@xslingcn

Description

@xslingcn

Summary

Sending local media files via the WhatsApp channel fails with LocalMediaAccessError: Local media path is not under an allowed directory even when the file is inside the agent's workspace directory.

Steps to reproduce

  1. Place a media file in the agent workspace (e.g. ~/workspace/sticker.webp)
  2. Use the message tool to send it via WhatsApp
  3. Observe LocalMediaAccessError: Local media path is not under an allowed directory

Expected behavior

The file should be sent successfully since it resides within the agent's workspace directory, which is included in getAgentScopedMediaLocalRoots.

Root Cause

The WhatsApp extension plugin's sendMedia handler in extensions/whatsapp/src/channel.ts does not destructure or forward mediaLocalRoots from the outbound context to sendMessageWhatsApp. This causes loadWebMedia -> assertLocalMediaAllowed to receive localRoots as undefined, falling back to the default roots which do not include the agent workspace directory.

The core src/channels/plugins/outbound/whatsapp.ts has the correct implementation (includes mediaLocalRoots), but it is unused, the actual runtime adapter comes from the extension plugin.

OpenClaw version

2026.2.21

Operating system

Ubuntu 25.10

Impact and severity

extensions/whatsapp/src/channel.ts: outbound.sendMedia callback

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions