The exception occurs in webhooks for GitLab Issues that contain labels:
[2023-09-19 13:31:11,227] [WARNING@maubot.instance.gitlab] Failed to process webhook
Traceback (most recent call last):
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 198, in _dict_to_attrs
new_items[name] = _try_deserialize(field_meta, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 229, in _try_deserialize
return _deserialize(field.type, value, field.default)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 277, in _deserialize
return _deserialize(args[0], value, default)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 280, in _deserialize
return [_deserialize(item_cls, item) for item in value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 280, in <listcomp>
return [_deserialize(item_cls, item) for item in value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 267, in _deserialize
return _dict_to_attrs(cls, value, default, default_if_empty=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 223, in _dict_to_attrs
obj.unrecognized_ = unrecognized
^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/attr/_make.py", line 605, in _frozen_setattrs
raise FrozenInstanceError()
attr.exceptions.FrozenInstanceError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/var/opt/maubot/test/plugins/xyz.maubot.gitlab-v0.2.1.1-ts1694083715170.mbp/gitlab_matrix/webhook.py", line 120, in try_process_hook
await self.process_hook(body, evt_type, room_id)
File "/var/opt/maubot/test/plugins/xyz.maubot.gitlab-v0.2.1.1-ts1694083715170.mbp/gitlab_matrix/webhook.py", line 134, in process_hook
evt = EventParse[evt_type].deserialize(body]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 375, in deserialize
return _dict_to_attrs(cls, data)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 198, in _dict_to_attrs
new_items[name] = _try_deserialize(field_meta, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 229, in _try_deserialize
return _deserialize(field.type, value, field.default)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 267, in _deserialize
return _dict_to_attrs(cls, value, default, default_if_empty=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/maubot/env/lib/python3.11/site-packages/mautrix/types/util/serializable_attrs.py", line 206, in _dict_to_attrs
raise SerializerError(
mautrix.types.util.serializable.SerializerError: Failed to deserialize [{'id': 497, 'title': 'testlabel', 'color': '#6699cc', 'project_id': 3431, 'created_at': '2023-09-19 11:30:49 UTC', 'updated_at': '2023-09-19 11:30:49 UTC', 'template': False, 'description': None, 'type': 'ProjectLabel', 'group_id': None, 'lock_on_merge': False}] into key labels of GitlabIssueAttributes
Our Gitlab running 16.4.1 had the same issue. Your suggested fix solved the issue for us :)
I suppose it would be easy enough to create a PR from it ;)
It appears that GitLab Labels have a new attribute
lock_on_merge: bool
, added in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/128667, which is part of a not yet merged feature: https://gitlab.com/gitlab-org/gitlab/-/issues/408676.GitLab version: 16.3.4-ce.0 from https://packages.gitlab.com/gitlab/gitlab-ce/debian/ buster main
The exception occurs in webhooks for GitLab Issues that contain labels:
This appears to fix it: