Discover error when installing flatpak apps (exit status 256)

I added the Flatpak (User) repo using the following command:

flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo

This allows me to install Flatpak apps only for the current user, it adds the option as a drop-down next to the install button in Discover and as a Flatpak repo in Discover settings.
I can install apps from this repo on the terminal flawlessly, but on discover halfway through the installation a popup appears with the following error and the installation cancels:

Aborted due to failure (While trying to apply extra data: apply_extra script failed, exit status 256)

Everything works fine when using the Flatpak repo to install the app system-wide on discover or when using any of the two (system or user) repos from the terminal.