From fb08bc56d70739d2e557f1c7ebbbb8180175d515 Mon Sep 17 00:00:00 2001 From: Rene Arumetsa Date: Fri, 4 Sep 2026 00:54:00 +0300 Subject: [PATCH] chore(teams): log role batch vs bot_top when edit_role_positions fails A 50013 on positioning despite Manage Roles points to a role in the reorder batch sitting at/above the bot's top role. Log the batch and bot_top so the offending role is identifiable from the journal. Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01XPRsW4tazVtYi2jNzVQkre --- core/member_sync.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/member_sync.py b/core/member_sync.py index 4c096de..a579fa4 100644 --- a/core/member_sync.py +++ b/core/member_sync.py @@ -480,6 +480,16 @@ async def apply_team_role_positions( return 0, errors except discord.HTTPException as e: errors.append(f"Tiimirollide järjestamine ebaõnnestus: {e}") + # 50013 here despite Manage Roles usually means a role in the batch sits + # at/above the bot's top role. Log the batch vs bot_top to pinpoint it. + log.warning( + "edit_role_positions failed (%s); bot_top=%d; batch=%s", + e, bot_top, + sorted( + ((r.name, r.position, target) for r, target in positions.items()), + key=lambda x: -x[1], + ), + ) return 0, errors log.info("Positioned %d team role(s) under their dividers", len(positions)) return len(positions), errors