Skip to content

Matrix Gateway: ejabberd sends empty messages -> Matrix bridges post erorr messages #4385

Open
@erebion

Description

@erebion

Before creating a ticket, please consider if this should fit the discussion forum better.

Environment

  • ejabberd version: 25.04
  • Erlang version: Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 15.2.6
  • OS: Linux (Debian)
  • Installed from: official deb/rpm

Configuration (only if needed): grep -Ev '^$|^\s*#' ejabberd.yml

loglevel: 4

Not sure this relates to any part of the config

Errors from error.log/crash.log

No errors

Bug description

Please, give us a precise description (what does not work, what is expected, etc.)

ejabberd occasionally sends empty messages:

{
  "content": {
    "body": "",
    "msgtype": "m.text",
    "net.process-one.xmpp-id": "02b22094-24b5-4f36-a9e7-a3e5ba8a4431"
  },
  "event_id": "$Ev9YPSJ4HVnj08uhJs5RN3PsF3PV4-BLmljY-IAEK50",
  "origin_server_ts": 1747674408209,
  "sender": "@erebion:ejabberd.erebion.eu",
  "type": "m.room.message",
  "unsigned": {
    "membership": "join"
  }
}

(Note that the body does not contain an actual message.)

Matrix bridges, such as Mautrix Discord, then respond with a message complaining about an error:

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

The logs of such a bridge 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}

Now, the questions are:

  • Does the Matrix spec allow empty messages?
  • Is that a bug with the bridge or is it correct in posting the error?
  • Should I open an issue on the bridge's bug tracker?

edit: fixed formatting

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions