SDL gets sometimes confused with hotplugged controllers
I saw https://gitlab.steamos.cloud/steam/steam-runtime-tools/-/issues/11 and this is probably related to the changes done in SDL to make it work within the container.
The problem happens from time to time, and can be hard to reproduce, but the gist is that unplugging / plugging controllers confuses SDL up to a point where it reports incorrect SDL_JOYDEVICEADDED events and then fails to open the corresponding /dev/input/eventX files on SDL_JoystickOpen.
With Proton, I reproduce the issue with a DualShock 4 and an X-Box 360 controller, and the game ICEY. The DS4 gamepad exposes two input devices (say /dev/input/event6 and /dev/input/event30), and the X-Box 360 one (and it usually reuses /dev/input/event6).
When the DS4 game pad is unplugged and the X-Box controller is plugged, SDL may report two SDL_JOYDEVICEADDED events (instead of one as we would expect), and opening the corresponding joysticks indexes fail with "Unable to open /dev/input/event6" and "Unable to open /dev/input/event30" message respectively.
It doesn't report any other SDL_JOYDEVICEADDED events after, and these two events shouldn't even be reported either, so I think there's maybe something that confuses SDL internal state completely.
On a side note, we also don't actually use SDL for the DS4 so we just ignore the joystick after opening it. There's a leak here and we don't close the joystick. However, closing it makes hotplug to stop working at all after the DS4 controller has been plugged once. I think it's because without UDEV, SDL relies on failed EVDEV reads to detect unplugged controllers, and closing the joystick makes it stop reading from its device file, and then it's unable to detect its removal.