From 32134a5e640fc8b6aa05e1d7dfabde8d20095466 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 1 Apr 2026 11:40:24 +0100 Subject: [PATCH] Add note about 413 not specced --- synapse/handlers/devicemessage.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/synapse/handlers/devicemessage.py b/synapse/handlers/devicemessage.py index 1ee2096557..3930c05f1c 100644 --- a/synapse/handlers/devicemessage.py +++ b/synapse/handlers/devicemessage.py @@ -249,6 +249,10 @@ class DeviceMessageHandler: # over federation, so as to more easily catch clients that are # sending excessively large messages. if len(encode_canonical_json(message_content)) > SOFT_MAX_EDU_SIZE: + # 413 is currently an unspecced response for `/sendToDevice` but is + # probably the best thing we can do. + # https://github.com/matrix-org/matrix-spec/pull/2340 tracks adding + # this to the spec raise EventSizeError( f"To-device message for {user_id}:{device_id} is too large to send", unpersistable=True,