When the bot starts up or when running the command 'refresh', it tries to sync 5 times and fails. The logs have the following exception every time (non fatal):
"@facebook_<ID>:<URL>" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it
Now I have checked all the different rooms and the bot has admin rights by default. Every time an error happens (for a total of 5 times), the last message sent is resent again. Bellow is a log with IDs/URLs replaced:
Sample log of last retry
```
[2023-10-07 22:50:45,079] [DEBUG@mau.user.@adminuser:matrix.example.com.api] Fetching 20 more threads from before 1696718422839
[2023-10-07 22:50:46,708] [DEBUG@mau.user.@adminuser:matrix.example.com] Syncing thread ThreadKey(other_user_id='100007800845473', thread_fbid=None)
[2023-10-07 22:50:46,717] [INFO@mau.portal.100007800845473<->100008358102243] Sending 20 new messages to !yjUY1OKWMneiobX7:matrix.example.com with batch ID None and previous event ID $_oSv42uO-8JDZXWuTNPM-PCIkwsWs84pbn23Ez-1_oM
[2023-10-07 22:50:46,717] [DEBUG@mau.as.api.@facebook_123456789012345:matrix.example.com] req #156: POST http://localhost:8008/_matrix/client/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com?user_id=@facebook_123456789012345:matrix.example.com {}
[2023-10-07 22:50:46,758] [DEBUG@mau.as.api.@facebook_123456789012345:matrix.example.com] req #156 (/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com) completed in 41.1ms with status 403
[2023-10-07 22:50:46,762] [DEBUG@mau.as.api.bot] req #157: POST http://localhost:8008/_matrix/client/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com?user_id=@facebookbot:matrix.example.com {}
[2023-10-07 22:50:46,796] [DEBUG@mau.as.api.bot] req #157 (/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com) completed in 34.6ms with status 403
[2023-10-07 22:50:46,797] [ERROR@mau.user.@adminuser:matrix.example.com] Failed to sync threads. Waiting 30 seconds before retrying sync.
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, in ensure_joined
await self.join_room(room_id, max_retries=0)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
return await __method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
room_id = await super().join_room(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
content = await self.api.request(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 415, in request
resp_data, resp = await self._send(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 265, in _send
raise make_request_error(
mautrix.errors.request.MForbidden: InputRoomEventsResponse: eventauth: "@facebook_123456789012345:matrix.example.com" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, in ensure_joined
await self.join_room(room_id, max_retries=0)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
return await __method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
room_id = await super().join_room(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
content = await self.api.request(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 415, in request
resp_data, resp = await self._send(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 265, in _send
raise make_request_error(
mautrix.errors.request.MForbidden: InputRoomEventsResponse: eventauth: "@facebookbot:matrix.example.com" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 601, in run_with_sync_lock
await func()
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 712, in _backfill_threads
await self._sync_threads_with_delay(
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 742, in _sync_threads_with_delay
had_new_messages = await self._sync_thread(thread)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 859, in _sync_thread
) = await portal.backfill_message_page(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix_facebook/portal.py", line 1081, in backfill_message_page
event_ids = [
^
File "/usr/lib/python3.11/site-packages/mautrix_facebook/portal.py", line 1082, in
await intent.send_message_event(
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
await __self.ensure_joined(room_id)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 602, in ensure_joined
await bot.invite_user(room_id, self.mxid)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
await __self.ensure_joined(room_id)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 600, in ensure_joined
raise IntentError(f"Failed to join room {room_id} as {self.mxid}") from e
mautrix.errors.base.IntentError: Failed to join room !yjUY1OKWMneiobX7:matrix.example.com as @facebookbot:matrix.example.com
[2023-10-07 22:51:16,805] [DEBUG@mau.user.@adminuser:matrix.example.com.api] Fetching 20 more threads from before 1696718422839
[2023-10-07 22:51:18,660] [DEBUG@mau.user.@adminuser:matrix.example.com] Syncing thread ThreadKey(other_user_id='100007800845473', thread_fbid=None)
[2023-10-07 22:51:18,667] [INFO@mau.portal.100007800845473<->100008358102243] Sending 20 new messages to !yjUY1OKWMneiobX7:matrix.example.com with batch ID None and previous event ID $_oSv42uO-8JDZXWuTNPM-PCIkwsWs84pbn23Ez-1_oM
[2023-10-07 22:51:18,668] [DEBUG@mau.as.api.@facebook_123456789012345:matrix.example.com] req #158: POST http://localhost:8008/_matrix/client/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com?user_id=@facebook_123456789012345:matrix.example.com {}
[2023-10-07 22:51:18,714] [DEBUG@mau.as.api.@facebook_123456789012345:matrix.example.com] req #158 (/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com) completed in 45.8ms with status 403
[2023-10-07 22:51:18,716] [DEBUG@mau.as.api.bot] req #159: POST http://localhost:8008/_matrix/client/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com?user_id=@facebookbot:matrix.example.com {}
[2023-10-07 22:51:18,743] [DEBUG@mau.as.api.bot] req #159 (/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com) completed in 27.3ms with status 403
[2023-10-07 22:51:18,743] [ERROR@mau.user.@adminuser:matrix.example.com] Failed to sync threads. Waiting 30 seconds before retrying sync.
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, in ensure_joined
await self.join_room(room_id, max_retries=0)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
return await __method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
room_id = await super().join_room(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
content = await self.api.request(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 415, in request
resp_data, resp = await self._send(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 265, in _send
raise make_request_error(
mautrix.errors.request.MForbidden: InputRoomEventsResponse: eventauth: "@facebook_123456789012345:matrix.example.com" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, in ensure_joined
await self.join_room(room_id, max_retries=0)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper
return await __method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room
room_id = await super().join_room(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room
content = await self.api.request(
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 415, in request
resp_data, resp = await self._send(
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 265, in _send
raise make_request_error(
mautrix.errors.request.MForbidden: InputRoomEventsResponse: eventauth: "@facebookbot:matrix.example.com" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 601, in run_with_sync_lock
await func()
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 712, in _backfill_threads
await self._sync_threads_with_delay(
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 742, in _sync_threads_with_delay
had_new_messages = await self._sync_thread(thread)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 859, in _sync_thread
) = await portal.backfill_message_page(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/mautrix_facebook/portal.py", line 1081, in backfill_message_page
event_ids = [
^
File "/usr/lib/python3.11/site-packages/mautrix_facebook/portal.py", line 1082, in
await intent.send_message_event(
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
await __self.ensure_joined(room_id)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 602, in ensure_joined
await bot.invite_user(room_id, self.mxid)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 141, in wrapper
await __self.ensure_joined(room_id)
File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 600, in ensure_joined
raise IntentError(f"Failed to join room {room_id} as {self.mxid}") from e
mautrix.errors.base.IntentError: Failed to join room !yjUY1OKWMneiobX7:matrix.example.com as @facebookbot:matrix.example.com
[2023-10-07 22:51:40,911] [INFO@aiohttp.access] 127.0.0.1 [07/Oct/2023:22:51:40 +0000] "GET /_matrix/app/v1/thirdparty/user/im.vector.protocol.sip_virtual?access_token=Txgw_LVSCCHHPKqPoBHsm97Qppjo7UQ2Z_JBzpMa01hSrVBmIkiZmmZ7nW-ZXcr3&native_mxid=%40facebookbot%3Amatrix.example.com HTTP/1.1" 404 192 "-" "Go-http-client/1.1"
[2023-10-07 22:51:41,222] [INFO@aiohttp.access] 127.0.0.1 [07/Oct/2023:22:51:41 +0000] "GET /_matrix/app/v1/thirdparty/user/im.vector.protocol.sip_virtual?access_token=Txgw_LVSCCHHPKqPoBHsm97Qppjo7UQ2Z_JBzpMa01hSrVBmIkiZmmZ7nW-ZXcr3&native_mxid=%40facebookbot%3Amatrix.example.com HTTP/1.1" 404 192 "-" "Go-http-client/1.1"
[2023-10-07 22:51:43,096] [INFO@aiohttp.access] 127.0.0.1 [07/Oct/2023:22:51:43 +0000] "GET /_matrix/app/v1/thirdparty/user/im.vector.protocol.sip_virtual?access_token=Txgw_LVSCCHHPKqPoBHsm97Qppjo7UQ2Z_JBzpMa01hSrVBmIkiZmmZ7nW-ZXcr3&native_mxid=%40facebook_123456789012345%3Amatrix.example.com HTTP/1.1" 404 192 "-" "Go-http-client/1.1"
[2023-10-07 22:51:43,288] [INFO@aiohttp.access] 127.0.0.1 [07/Oct/2023:22:51:43 +0000] "GET /_matrix/app/v1/thirdparty/user/im.vector.protocol.sip_virtual?access_token=Txgw_LVSCCHHPKqPoBHsm97Qppjo7UQ2Z_JBzpMa01hSrVBmIkiZmmZ7nW-ZXcr3&native_mxid=%40facebook_123456789012345%3Amatrix.example.com HTTP/1.1" 404 192 "-" "Go-http-client/1.1"
[2023-10-07 22:51:48,747] [ERROR@mau.user.@adminuser:matrix.example.com] Failed to sync threads five times. Will not retry.
```
When the bot starts up or when running the command 'refresh', it tries to sync 5 times and fails. The logs have the following exception every time (non fatal):
"@facebook_<ID>:<URL>" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it
Now I have checked all the different rooms and the bot has admin rights by default. Every time an error happens (for a total of 5 times), the last message sent is resent again. Bellow is a log with IDs/URLs replaced:Sample log of last retry
``` [2023-10-07 22:50:45,079] [DEBUG@mau.user.@adminuser:matrix.example.com.api] Fetching 20 more threads from before 1696718422839 [2023-10-07 22:50:46,708] [DEBUG@mau.user.@adminuser:matrix.example.com] Syncing thread ThreadKey(other_user_id='100007800845473', thread_fbid=None) [2023-10-07 22:50:46,717] [INFO@mau.portal.100007800845473<->100008358102243] Sending 20 new messages to !yjUY1OKWMneiobX7:matrix.example.com with batch ID None and previous event ID $_oSv42uO-8JDZXWuTNPM-PCIkwsWs84pbn23Ez-1_oM [2023-10-07 22:50:46,717] [DEBUG@mau.as.api.@facebook_123456789012345:matrix.example.com] req #156: POST http://localhost:8008/_matrix/client/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com?user_id=@facebook_123456789012345:matrix.example.com {} [2023-10-07 22:50:46,758] [DEBUG@mau.as.api.@facebook_123456789012345:matrix.example.com] req #156 (/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com) completed in 41.1ms with status 403 [2023-10-07 22:50:46,762] [DEBUG@mau.as.api.bot] req #157: POST http://localhost:8008/_matrix/client/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com?user_id=@facebookbot:matrix.example.com {} [2023-10-07 22:50:46,796] [DEBUG@mau.as.api.bot] req #157 (/v3/join/%21yjUY1OKWMneiobX7%3Amatrix.example.com) completed in 34.6ms with status 403 [2023-10-07 22:50:46,797] [ERROR@mau.user.@adminuser:matrix.example.com] Failed to sync threads. Waiting 30 seconds before retrying sync. Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, in ensure_joined await self.join_room(room_id, max_retries=0) File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper return await __method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room room_id = await super().join_room( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room content = await self.api.request( ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 415, in request resp_data, resp = await self._send( ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 265, in _send raise make_request_error( mautrix.errors.request.MForbidden: InputRoomEventsResponse: eventauth: "@facebook_123456789012345:matrix.example.com" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 596, in ensure_joined await self.join_room(room_id, max_retries=0) File "/usr/lib/python3.11/site-packages/mautrix/appservice/api/intent.py", line 128, in wrapper return await __method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/client/store_updater.py", line 62, in join_room room_id = await super().join_room( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/client/api/rooms.py", line 335, in join_room content = await self.api.request( ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 415, in request resp_data, resp = await self._send( ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix/api.py", line 265, in _send raise make_request_error( mautrix.errors.request.MForbidden: InputRoomEventsResponse: eventauth: "@facebookbot:matrix.example.com" is not allowed to change their membership from "leave" to "join" as join rule "invite" forbids it The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 601, in run_with_sync_lock await func() File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 712, in _backfill_threads await self._sync_threads_with_delay( File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 742, in _sync_threads_with_delay had_new_messages = await self._sync_thread(thread) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix_facebook/user.py", line 859, in _sync_thread ) = await portal.backfill_message_page( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/mautrix_facebook/portal.py", line 1081, in backfill_message_page event_ids = [ ^ File "/usr/lib/python3.11/site-packages/mautrix_facebook/portal.py", line 1082, in