Invalid Context warnings about icon themes when starting certain apps

When I start okular from the terminal, I get a bunch of "Invalid Context" warnings about certain icon theme folders (both from Yaru, which is the theme set in Gnome Tweaks, and Adwaita). Editing the index.theme for the named directories to be excluded erases the warnings, but then breaks some of the UI (The little arrows in the top bar settings become crossed-circle forbidden icons), which I guess is to be expected.

Googling shows that this happened to a lot of people on a variety of apps, but solutions I found were not applicable (app-specific or for Arch).

Okular seems to work fine. I recently upgraded to 20.4 from 19.10, but the error existed before that, as well.

Does anyone know why I am getting these warnings or how to fix them?

full command-line output:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/16x16/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/24x24/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/32x32/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/48x48/legacy/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/apps/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/mimetypes/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/scalable/mimetypes/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/8x8/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/16x16/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/16x16/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/24x24/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/24x24/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/32x32/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/32x32/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/48x48/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/48x48/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/64x64/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/64x64/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/96x96/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/96x96/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/256x256/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/512x512/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/scalable/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/scalable/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/16x16/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/24x24/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/32x32/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Yaru/48x48/legacy/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/apps/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/256x256@2x/mimetypes/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Yaru/scalable/mimetypes/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/8x8/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/16x16/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/16x16/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/24x24/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/24x24/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/32x32/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/32x32/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/48x48/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/48x48/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/64x64/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/64x64/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/96x96/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/96x96/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/256x256/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/512x512/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/scalable/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/scalable/ui/"

Solution 1:

It seems (as mentioned here and here) some icon themes (in your case, Yaru and Adwaita) don't have all contexts specified.
The easiest solution I found to get rid of these warnings messages with Okular was to use another icon theme, for example, use oxygen-icon-theme in Ubuntu.
Install oxygen-icon-theme from the terminal with:

sudo apt update
sudo apt-get install oxygen-icon-theme

Then, go to Tweaks and change the Icons option to Oxygen in the Appearance menu.