Skip to content

Error when a Matrix message is empty #186

@erebion

Description

@erebion

When a Matrix message contains an empty body, the bridge responds with an error:

⚠ Your message was not bridged: 50006: Cannot send an empty message

This is annoying, as this allows spamming a room quite easily.

10 empty messages become 20 messages as 10 error messages are added.

Logs contain the following:

2025-05-19T17:06:48Z DBG Sent message checkpoint message_checkpoint={"event_id":"$Ev9YPSJ4HVnj08uhJs5RN3PsF3PV4-BLmljY-IAEK50","event_type":"m.room.message","message_type":"m.text","reported_by":"BRIDGE","retry_num":0,"room_id":"!avHtPbJBFIkqXODJcI:matrix.un-hack-bar.de","status":"SUCCESS","step":"BRIDGE","timestamp":1747674408484}
2025-05-19T17:06:48Z ERR Matrix event not handled error="HTTP 400 Bad Request, {\"message\": \"Cannot send an empty message\", \"code\": 50006}" action="send matrix message metrics" channel_id=637233944919539712 channel_receiver= event_id=$Ev9YPSJ4HVnj08uhJs5RN3PsF3PV4-BLmljY-IAEK50 event_type=m.room.message result="Error sending event" room_id=!avHtPbJBFIkqXODJcI:matrix.un-hack-bar.de sender=@erebion:ejabberd.erebion.eu
2025-05-19T17:06:48Z DBG Sent message checkpoint message_checkpoint={"event_id":"$Ev9YPSJ4HVnj08uhJs5RN3PsF3PV4-BLmljY-IAEK50","event_type":"m.room.message","info":"HTTP 400: 50006: Cannot send an empty message","message_type":"m.text","reported_by":"BRIDGE","retry_num":0,"room_id":"!avHtPbJBFIkqXODJcI:matrix.un-hack-bar.de","status":"PERM_FAILURE","step":"REMOTE","timestamp":1747674408637}

The bridge should just ignore empty messages or at least have a setting that allows ignoring them, without disabling all error messages.

EDIT: fixed a typo
EDIT 2: fixed another typo

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions