I experimented a little bit. It seems like this error only shows when the window has a specific size. The one you get after dragging the window to the upper edge of the screen for resizing, for example. Commented this on your post, too. Maybe could help understand that error.
Same issue, KDE desktop, Arch Linux. Only happens for me when Minecraft is in Window mode and on a specific size, for example desktop size (like when you drag the window to the upper edge of the desktop, it will resize to to "problematic" window size).
I experimented a little bit. It seems like this error only shows when the window has a specific size. The one you get after dragging the window to the upper edge of the screen for resizing, for example. Commented this on your post, too. Maybe could help understand that error.