diff --git a/synapse/types/state.py b/synapse/types/state.py index 937ffe3f979..3c61cea992e 100644 --- a/synapse/types/state.py +++ b/synapse/types/state.py @@ -591,6 +591,9 @@ def __contains__(self, key: Any) -> bool: typ, state_key = key + if not isinstance(typ, str) or not isinstance(state_key, str): + return False + if typ in self.types: state_keys = self.types[typ] if state_keys is None or state_key in state_keys: