Bug 442721

Summary: kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
Product: [Frameworks and Libraries] frameworks-kservice Reporter: shenlebantongying <shenlebantongying>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: 1900011604, 4wy78uwh, 5longluna, a.samirh78, amanita+KDEBUGS, apoorvpotnis, axel.braun, bero, bugster, curlypaul924, d_debnath, gardotd426, imaduddinh, kde-bugs, kdelibs-bugs, lavov50334, lee295012, maxrd2, ojsl, pepko94, rajeeshknambiar, shafff, thesourcehim, windows2linux
Priority: NOR    
Version: 5.108.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.116

Description shenlebantongying 2021-09-20 05:32:20 UTC
kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found

I always get this message when some application open by mine type.

How can I add this mime type to somewhere? Is there a registry for this?
Comment 1 flan_suse 2021-10-05 19:08:15 UTC
Maybe we're seeing the same thing?

https://bugs.kde.org/show_bug.cgi?id=443319
Comment 2 Mladen Milinkovic, Max 2021-10-08 13:43:26 UTC
Can confirm this on kf5 5.86.0.

Hope following snippet is helpful.

Before, below code would open the example.js file in text editor.
Now it fails with:
```
kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
Could not launch external editor.
```

```
	const QUrl script = QUrl::fromLocalFile("..../scripts/example.js");
	KIO::OpenUrlJob *job = new KIO::OpenUrlJob(script);
	job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, app()->mainWindow()));
	if(!job->exec()) {
		qDebug() << job->errorString();
		if(!QDesktopServices::openUrl(script))
			qDebug() << "Could not launch external editor.";
	}
```
Comment 3 flan_suse 2021-10-08 15:10:11 UTC
*** Bug 443319 has been marked as a duplicate of this bug. ***
Comment 4 Mladen Milinkovic, Max 2021-10-10 21:00:11 UTC
Looks like it's fixed in 5.87.0
Comment 5 petrk 2021-10-21 22:34:00 UTC
Present with 5.87 for me.
Comment 6 shenlebantongying 2021-12-13 10:18:16 UTC
This bug can be triggered by both "xdg-open" and "kde-open5".

I think I just find the related code is here:

It bypasses "x-scheme-handler" but didn't bypass "x-scheme-handler/file",

https://invent.kde.org/frameworks/kservice/-/blob/v5.89.0/src/services/kapplicationtrader.cpp#L26
Comment 7 shenlebantongying 2021-12-13 11:32:08 UTC
The last comment is wrong, but I cannot edit it. The code was submitted here.

https://phabricator.kde.org/D25698
Comment 8 AlexDeLorenzo.dev 2022-02-07 04:17:57 UTC
I'm encountering this issue on kf5 5.90.0:

    $ xdg-open .
    kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found

KDE Plasma Version: 5.23.5
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 9 imad 2022-02-25 20:36:32 UTC
I'm encountering this on an up-to-date Arch Linux system.

Plasma Desktop: 5.24.2
KDE Frameworks: 5.91.0
Qt: 5.15.2
Platform: X11
Hardware: Nvidia

The bug can be reproduced consistently on my multi-monitor setup:

1. Open "Display Configuration" in System Settings
2. Disable primary monitor
3. Enable primary monitor after some time

The above steps are sufficient to reproduce the problem. Restarting kwin/plasmadesktop does not help. The problem does not occur on a fresh restart though. The monitor needs to be disabled to reproduce it.

Examining with Journalctl, I see :


kwin_x11[2736]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 16715, resource id: 138412039, major code: 18 (ChangeProperty), minor code: 0
kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
kioclient5[196052]: kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
kwin_x11[2736]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 8651, resource id: 142606341, major code: 18 (ChangeProperty), minor code: 0
kwin_x11[2736]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 8656, resource id: 142606342, major code: 18 (ChangeProperty), minor code: 0
kwin_x11[2736]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 8660, resource id: 142606343, major code: 18 (ChangeProperty), minor code: 0
Comment 10 pridoorok 2022-03-14 17:56:25 UTC
a workaround has been found - you need to:

enable hidden files in dolphin then go to your home dir (/home/username) then go to hidden .config dir in there you need to find file named mimeapps.list edit it,  add this string (x-scheme-handler/file=org.kde.dolphin.desktop;) to all sub strings for example:

[Added Associations]
.....
.....
x-scheme-handler/file=org.kde.dolphin.desktop;

[Default Applications]
.....
.....
x-scheme-handler/file=org.kde.dolphin.desktop;

then execute this command in the terminal:  update-mime-database ~/.local/share/mime

it's worked for me, after that system links has became open in dolphin

more info:
https://wiki.archlinux.org/title/XDG_MIME_Applications
https://bugzilla.redhat.com/show_bug.cgi?id=674321
Comment 11 flan_suse 2022-03-14 18:41:06 UTC
(In reply to pridoorok from comment #10)
> a workaround has been found - you need to:

Wow! That worked perfectly! Thank you so much. :)

I wonder why this is even needed for KDE? Why doesn't it "just work" as expected by default?
Comment 12 Rajeesh K V 2022-04-28 08:45:01 UTC
(In reply to pridoorok from comment #10)
> a workaround has been found - you need to:
> 
> (x-scheme-handler/file=org.kde.dolphin.desktop;) to all sub strings for

This work around gets rid of the warning for me; but it also unnecessary opens dolphin when I do
`xdg-open /some/file.pdf`.

I'm on Wayland, Frameworks 5.91, Plasma 5.24.4, Fedora 35.
Comment 13 Apoorv Potnis 2022-06-08 14:16:23 UTC
I get the following message when I open any PDF file in Okular 22.04.1 (KDE 5.24.5) via Konsole.

    kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
    kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
    qt.xkb.compose: failed to create compose table
Comment 15 Ahmad Samir 2022-08-19 14:48:34 UTC
Git commit a4c404603bbf43fda2d60c82c814527bde0a8352 by Ahmad Samir.
Committed on 19/08/2022 at 14:31.
Pushed by ahmadsamir into branch 'master'.

DesktopExecParser: don't kioexec if there is a handler for scheme

This fixes an issue where the code called
KApplicationTrader::queryByMimeType("x-scheme-handler/file"), which would
trigger a warning in KApplicationTrader, because there is no
x-scheme-handler/file mimtype.
FIXED-IN: 5.96

M  +24   -12   src/core/desktopexecparser.cpp

https://invent.kde.org/frameworks/kio/commit/a4c404603bbf43fda2d60c82c814527bde0a8352
Comment 16 Max 2022-11-01 18:25:29 UTC
I'm seeing this problem again when trying to open directory from Qt application using QDesktopServices::openUrl. It should invoke dolphin to open directory but instead prints:
kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found

Operating System: Fedora Linux 36
KDE Plasma Version: 5.26.0
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 6.0.5-200.fc36.x86_64 (64-bit)
Graphics Platform: X11
Comment 17 Firestar-Reimu 2023-02-02 00:51:25 UTC
I encounter this bug when using `texdoc` of TeXLive, like this:
```
[firestar @ ArchLinux ~] (08:42:14)
$ texdoc tex
[firestar @ ArchLinux ~] (08:42:16)
$ kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
```
Then I changed the settings like https://bugs.kde.org/show_bug.cgi?id=442721#c10, I use Okular which is my default app for PDF

But this lead to that other files which do not use Okular will open by Okular now, like jupyter-lab which also use `xdg-open`
Comment 18 Axel Braun 2023-03-10 11:40:25 UTC
I see this issue again when attaching an Android device and launching the file manager:
Mär 10 12:35:18 X1E kernel: usb 1-1: new high-speed USB device number 17 using xhci_hcd
Mär 10 12:35:19 X1E kernel: usb 1-1: New USB device found, idVendor=04e8, idProduct=6860, bcdDevice= c.00
Mär 10 12:35:19 X1E kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mär 10 12:35:19 X1E kernel: usb 1-1: Product: SAMSUNG_Android
Mär 10 12:35:19 X1E kernel: usb 1-1: Manufacturer: SAMSUNG
Mär 10 12:35:19 X1E kernel: usb 1-1: SerialNumber: RF8M72D9FLZ
Mär 10 12:35:19 X1E kernel: cdc_acm 1-1:1.1: ttyACM0: USB ACM device
Mär 10 12:35:19 X1E kernel: usbcore: registered new interface driver cdc_acm
Mär 10 12:35:19 X1E kernel: cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters

Mär 10 12:35:24 X1E plasmashell[2149]: DeviceServiceAction::execute:  "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:14.0/usb1/1-1"  is not a StorageAccess device
Mär 10 12:35:24 X1E systemd[1867]: Started Dolphin - Dateiverwaltung.
Mär 10 12:35:24 X1E kde-open5[6597]: kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
Mär 10 12:35:24 X1E akonadiserver[2562]: org.kde.pim.akonadiserver: ItemRetrievalJob for request 62421 finished
Mär 10 12:35:24 X1E systemd[1867]: Started Dolphin - Dateiverwaltung.

-> Dolphin opens the home directory instead
Operating System: openSUSE Tumbleweed 20230306
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.2.1-1-default (64-bit)
Comment 19 Sergei S. Rublёv 2023-03-21 13:30:30 UTC
I see this in terminal just after "xdg-open ~" command. KDE 5.27.3
Comment 20 bugster 2023-08-07 05:33:59 UTC
I still have this problem on KDE-Framework-Version: 5.108.0 while using Qt programs on xwayland that try to open documents with QDesktopServices::openUrl()
Comment 21 bugster 2023-08-07 12:21:17 UTC
I found out that this mimetype handling problem only arise if I try to use my own Qt libs v5.15.2 
Same libs working fine on GTK (XFCE). No idea why they fail on KDE?
Comment 22 Matt M (gardotd426) 2023-10-20 22:00:50 UTC
This is still an issue on KDE Frameworks 5.110.0. Trying to run `~/.fightcade2/Fightcade.sh roms` gives:

kf.service.services: KApplicationTrader: mimeType "x-scheme-handler/file" not found
Comment 23 Olivia Laari 2023-10-30 18:25:18 UTC
Getting this for all my .desktop files when running them through kioclient exec or xdg-open, though none of them are failing to launch because of it. The said kf.service.services warning also only shows in terminal output, I never see it in my journal unlike the logs for other plasmashell kf.service components.

X11, Framework 5.111.0, KDE 5.27.9, Qt 5.15.11, Manjaro
Comment 24 David Faure 2024-03-03 09:27:31 UTC
Git commit d0f416ea064539adbffb471d7e0d9767c7d125a9 by David Faure.
Committed on 03/03/2024 at 09:27.
Pushed by dfaure into branch 'kf5'.

Fix warning: mimeType "x-scheme-handler/file" not found

commit b5af9b4eb021f772ce27b466409f6bd1efd72969 ported KIO::DesktopExecParser::hasSchemeHandler
from KMimeTypeTrader to KApplicationTrader, but it turns out there was a slight difference
between the two: KMimeTypeTrader had two if()s for silencing the x-scheme-handler/* warnings,
while KApplicationTrader had only one. Maybe I misread the code back then and failed to see
the "mime = mimeType" line (rather than return) which makes us proceed further down after
QMimeDatabase says the mimetype doesn't exist.
FIXED-IN: 5.116

M  +3    -1    src/services/kapplicationtrader.cpp

https://invent.kde.org/frameworks/kservice/-/commit/d0f416ea064539adbffb471d7e0d9767c7d125a9
Comment 25 David Faure 2024-03-03 09:28:26 UTC
Git commit 3e5a56b9a38258e81362261df9d9288ebfb13eaa by David Faure.
Committed on 03/03/2024 at 09:28.
Pushed by dfaure into branch 'master'.

Fix warning: mimeType "x-scheme-handler/file" not found

commit b5af9b4eb021f772ce27b466409f6bd1efd72969 ported KIO::DesktopExecParser::hasSchemeHandler
from KMimeTypeTrader to KApplicationTrader, but it turns out there was a slight difference
between the two: KMimeTypeTrader had two if()s for silencing the x-scheme-handler/* warnings,
while KApplicationTrader had only one. Maybe I misread the code back then and failed to see
the "mime = mimeType" line (rather than return) which makes us proceed further down after
QMimeDatabase says the mimetype doesn't exist.
FIXED-IN: 5.116
(cherry picked from commit d0f416ea064539adbffb471d7e0d9767c7d125a9)

M  +3    -1    src/services/kapplicationtrader.cpp

https://invent.kde.org/frameworks/kservice/-/commit/3e5a56b9a38258e81362261df9d9288ebfb13eaa
Comment 26 David Faure 2024-03-03 09:29:33 UTC
*** Bug 481263 has been marked as a duplicate of this bug. ***