diff --git a/synapse/api/errors.py b/synapse/api/errors.py
index 8b9766fab7a9309b64cb6e657e31b3b223077de8..b5970c959b73d9c7dd6995fec6b827468a359ecc 100644
--- a/synapse/api/errors.py
+++ b/synapse/api/errors.py
@@ -74,7 +74,10 @@ class AuthError(SynapseError):
 
 class EventStreamError(SynapseError):
     """An error raised when there a problem with the event stream."""
-    pass
+    def __init__(self, *args, **kwargs):
+        if "errcode" not in kwargs:
+            kwargs["errcode"] = Codes.BAD_PAGINATION
+        super(EventStreamError, self).__init__(*args, **kwargs)
 
 
 class LoginError(SynapseError):