Skip to content

Invalid Matrix s2s errors #4541

@famfo

Description

@famfo

Environment

  • ejabberd version: 26.01
  • Erlang version: Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 15.2.7.6
  • OS: Linux (Alpine Linux)
  • Installed from: distro package

Errors from error.log/crash.log

No errors

Bug description

Errors returned from the Matrix s2s module do not follow the Matrix specification, or at least the implied "standard" for them. For example on the invite endpoint /_matrix/federation/v2/invite/{roomId}/{eventId} on invalid room versions:

https://github.com/processone/ejabberd/blob/master/src/mod_matrix_gw.erl#L185

400 Bad Request: unsupported room version

Is specified to return something along the lines of:

{
    "errcode": "M_INCOMPATIBLE_ROOM_VERSION",
    "error": "unsupported room version",
    "room_version": "3"
}

(From https://spec.matrix.org/v1.17/server-server-api/#put_matrixfederationv2inviteroomideventid)

Note that not all endpoints have clearly specified errors and even the errcode is extremely fuzzy in many places. https://spec.matrix.org/v1.17/client-server-api/#common-error-codes has a non-exhaustive list of some of the more common error codes as well.

The convention for errors I have gotten from reading the Matrix spec is something along these lines:

{
  "errcode": "<error code>",
  "error": "<human readable error>"
}

Edit: I found the definition of errors, it is also in the c2s API next to the known error codes, I just missed it ^^'

https://spec.matrix.org/v1.17/client-server-api/#standard-error-response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions