Filechooser not working due to missing key 'view-type'

Long story short, the filechooser window doesn’t show up when I click on something that calls it. No browser uploads, no Ctrl+O in Okular to open a document.
I digged and found this:
When no filechooser is called, the “xdg-desktop-portal-gnome” service is running fine (checked using systemctl --user status [ServiceName] )

But when I call a filechooser, that service dies with this error:

Settings schema 'org.gtk.gtk4.Settings.FileChooser' does not contain a key named 'view-type'

What should I do?

Update: I’m on gnome 45.3 with the 6.1 Manjaro Kernel and have not messed with gtk4 stuff in any way

Welcome to the forum! :wave:

The schema does contain the key:

❯ grep view-type /usr/share/glib-2.0/schemas/org.gtk.gtk4.Settings.FileChooser.gschema.xml
    <key name="view-type" enum="org.gtk.gtk4.Settings.FileChooser.ViewType">

I suggest reinstalling gtk4 and it will automatically recompile the schemas.

sudo pacman -Syu gtk4

That didn’t work… I had already tried that
here’s the service’s status before calling a filechooser:

> systemctl --user status xdg-desktop-portal-gnome

xdg-desktop-portal-gnome.service - Portal service (GNOME implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gnome.service; static)
     Active: active (running) since Thu 2024-01-18 09:21:19;
   Main PID: 6144 (xdg-desktop-por)
      Tasks: 5 (limit: 9347)
     Memory: 23.3M (peak: 23.8M)
        CPU: 863ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/xdg-desktop-portal-gnome.service
             └─6144 /usr/lib/xdg-desktop-portal-gnome

Jan 18 09:21:18 [myname] systemd[1092]: Starting Portal service (GNOME implementation)...
Jan 18 09:21:19 [myname] xdg-desktop-por[6144]: Theme parser error: gtk.css:4603:21-28: Expected a valid color.
Jan 18 09:21:19 [myname] xdg-desktop-por[6144]: Theme parser error: gtk.css:4682:21-28: Expected a valid color.
Jan 18 09:21:19 [myname] xdg-desktop-por[6144]: Theme parser error: gtk.css:4812:21-28: Expected a valid color.
Jan 18 09:21:19 amirslaptop systemd[1092]: Started Portal service (GNOME implementation).

and here’s after calling a filechooser window (same thing all over the system):

xdg-desktop-portal-gnome.service - Portal service (GNOME implementation)
     Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal-gnome.service; static)
     Active: failed (Result: core-dump) since Thu 2024-01-18 09:27:29;
   Duration: 6min 10.558s
    Process: 6144 ExecStart=/usr/lib/xdg-desktop-portal-gnome (code=dumped, signal=TRAP)
   Main PID: 6144 (code=dumped, signal=TRAP)
        CPU: 1.212s

Jan 18 09:21:18 [myusernamehere] systemd[1092]: Starting Portal service (GNOME implementation)...
Jan 18 09:21:19 [myusernamehere] xdg-desktop-por[6144]: Theme parser error: gtk.css:4603:21-28: Expected a valid color.
Jan 18 09:21:19 [myusernamehere] xdg-desktop-por[6144]: Theme parser error: gtk.css:4682:21-28: Expected a valid color.
Jan 18 09:21:19 [myusernamehere] xdg-desktop-por[6144]: Theme parser error: gtk.css:4812:21-28: Expected a valid color.
Jan 18 09:21:19 [myusernamehere] systemd[1092]: Started Portal service (GNOME implementation).
Jan 18 09:27:25 [myusernamehere] xdg-desktop-por[6144]: Settings schema 'org.gtk.gtk4.Settings.FileChooser' does not contain a key named 'view-type'
Jan 18 09:27:29 [myusernamehere] systemd-coredump[11866]: Process 6144 (xdg-desktop-por) of user 1000 dumped core.
                                                     
                                                     Stack trace of thread [threadnumber]:
                                                     [Deleted]

Jan 18 09:27:29 [myusernamehere] systemd[1092]: xdg-desktop-portal-gnome.service: Main process exited, code=dumped, status=5/TRAP
Jan 18 09:27:29 [myusernamehere] systemd[1092]: xdg-desktop-portal-gnome.service: Failed with result 'core-dump'.
Jan 18 09:27:29 [myusernamehere] systemd[1092]: xdg-desktop-portal-gnome.service: Consumed 1.212s CPU time, 23.8M memory peak.

Question: Is it a good idea to add the key myself and recompile the schemas? I assume not because it’ll be broken after the next gtk4 update

Question-2: Is there a way to reset the schemas in a way? or find the “Default” schema and replace the filechooser schema with what it was supposed to be?

UPDATE: It works with VS Code but doesn’t work with basically anything else that I have tried. I Think VS Code uses another filechooser service call (I know xdg-desktop-portal-gtk is on here too because it’s required by xdg-desktop-portal-gnome).

As I mentioned above, the schema already contains the key. You can verify by running the same command I did.

Are there any conflicting schemas? You should only have the FileChooser schemas from gtk4 and gtk3:

❯ ls /usr/share/glib-2.0/schemas | grep FileChooser
org.gtk.gtk4.Settings.FileChooser.gschema.xml
org.gtk.Settings.FileChooser.gschema.xml

Do you have any schemas in user space that could be overriding it?

ls ~/.local/share/glib-2.0/schemas/

Do you have any AUR / foriegn packages that could be interfering?

pacman -Qm
  1. The output matches yours
  2. No such file or directory
  3. Nope

And the key is contained… then why doesn’t xdg-desktop-portal-gnome find the key? what’s going on?

What does that mean? What’s the output?

I don’t know. Have you researched the internet to see if others may have had a similar issue? I can’t reproduce it, so I’m out of ideas.