Plugin: imessage 0.2.0 (external_plugins/imessage/server.ts, line 424; still unchanged on main as of 2026-10-23)
macOS: 26.7.1 (Tahoe), Mac mini M4, Messages signed in to iMessage
Use case: Claude Code agent running unattended with --channels plugin:imessage@claude-plugins-official
What happens
reply with files: ["/abs/path/file.png"] returns success (osascript exits 0) and the agent tells the user the file was sent, but the file never arrives on the recipient's devices (iPhone, another Mac). On the sending Mac, Messages shows an empty outgoing bubble. In ~/Library/Messages/chat.db the outgoing message has no row in attachment / message_attachment_join, i.e. Messages accepted the command but attached nothing. Same result for PNG, JPEG and PDF, for files in ~/Pictures, ~/Downloads and ~/Documents, with and without extended attributes (quarantine/provenance).
Root cause
SEND_FILE_SCRIPT passes a POSIX file (file URL) to send:
tell application "Messages" to send (POSIX file (item 1 of argv)) to chat id (item 2 of argv)On macOS 26, Messages only attaches the file when it receives an alias:
tell application "Messages" to send ((POSIX file (item 1 of argv)) as alias) to chat id (item 2 of argv)A/B test (same source PNG, same 1:1 iMessage chat, 2026-10-26; checked in chat.db 60 s after sending and on the recipient's iPhone and Mac)
| Test | File | AppleScript | osascript | Attachment row in chat.db | Arrived |
|---|---|---|---|---|---|
| T1 | copy with xattrs, ~/Pictures | send (POSIX file …) (plugin) | exit 0 | none | no |
| T2 | fresh file, ~/Pictures | send (POSIX file …) | exit 0 | none | no |
| T3 | fresh file, ~/Pictures | send ((POSIX file …) as alias) | exit 0 | transfer_state 5, delivered | yes |
| T4 | file written via Messages' do shell script | as alias | exit 0 | transfer_state 5, delivered | yes |
| T5 | fresh file, ~/Downloads | send (POSIX file …) | exit 0 | none | no |
| T6 | fresh file, ~/Pictures | as alias to buddy instead of chat id | exit 0 | transfer_state 5, delivered | yes |
The only variable that matters is as alias. File location and extended attributes make no difference.
Suggested fix
- Change
SEND_FILE_SCRIPTtosend ((POSIX file (item 1 of argv)) as alias) to chat id (item 2 of argv). - Because osascript exits 0 even when nothing is attached, consider verifying the send: after a few seconds, check chat.db for an outgoing attachment row with the file's
transfer_nameand return an error to the model if none exists. Otherwise the agent confidently reports "sent" while the user receives nothing.
Workaround we use now: a small MCP tool that copies the file to ~/Pictures/<subfolder>/, sends it with as alias and polls chat.db (attachment.transfer_state = 5, message.is_delivered = 1) before reporting success.
Thanks :).
Activity
0No activity yet.