discord icon indicating copy to clipboard operation
discord copied to clipboard

Error when a Matrix message is empty

Open erebion opened this issue 7 months ago • 2 comments

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

erebion avatar May 19 '25 17:05 erebion

@erebion: Thanks for your ticket :)

Neustradamus avatar May 21 '25 13:05 Neustradamus

@erebion: Thanks for your ticket :)

I hope it will have an effect. And I would fix this myself, but nor sure how.

Anyway, I'm not sure why this would even be an error.

There's nothing to bridge. Why would there be an error?

erebion avatar May 21 '25 19:05 erebion