Nvidia prime-run returns error

The problem seems to be that the modesetting Xorg driver binds to the NVIDIA GPU for some reason. A workaround could be to force the NVIDIA Xorg driver. Create /etc/X11/xorg.conf.d/90-intel-nvidia.conf:

# Adapted from https://download.nvidia.com/XFree86/Linux-x86_64/460.32.03/README/randr14.html

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Inactive "nvidia"
    Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection

and reboot, and try prime-run again.