Fix Unable to detect the URI-scheme of magnet Error In Xubuntu

I was trying to download a ‘file’ from a torrent site with Magnet links. I was using Google Chrome in Xubuntu and surprisingly instead of opening a torrent client, it threw an error which read like:

Unable to detect the URI-scheme of “magnet:?

It was surprising for me as I never encountered such an error ever with other Linux OS such as Ubuntu or Linux Mint. After looking for a little, it turned out to be a bug in Linux OS based on Xfce desktop environments. In this quick tip, I’ll share with you the fix I used for to solve the “Unable to detect the URI-scheme of “magnet:” error in Xubuntu.

Fix Unable to detect the URI-scheme of “magnet: error

We will edit xdg-open file. You can use your preferred text editor be it GUI based or terminal based such as Vi. In Xubuntu, you can use mousepad in a terminal using the following command:

sudo mousepad /usr/bin/xdg-open

In the opened file, look for lines like:

open_xfce()
{
exo-open "$1"
if [ $? -eq 0 ]; then
exit_success
else
exit_failure_operation_failed
fi
}

Replace the above lines with the following and save the file:

open_xfce()
{
if (echo "$1" | grep -q '^magnet:'); then
transmission-gtk "$1"
else
exo-open "$1"
fi
if [ $? -eq 0 ]; then
exit_success
else
exit_failure_operation_failed
fi
}

If you are using any torrent application other than Transmission, you can use that application name in the above command in place of transmission-gtk.

Once you saved the changes, you should be able to open magnet files. No need to restart or even logout. It will start working straightaway.

What we did to fix the problem

You problem is fixed but just in case you want to know what we did to fix the problem of “Unable to detect the URI-scheme of “magnet:”. If you are familiar with shell scripting you can easily figure it out.

Here, if the argument to a command includes something that begins with “magnet:”, it will pass that argument to Transmission (or your own torrent application). As the standard with magnet links, they always start with “magnet:” so all the magnet links will now be opened with Transmission.

I hope this quick post helped you to fix “Unable to detect the URI-scheme of “magnet:” error not only in Xubuntu but alos in other Xfce based distros such as ArchLinux, Manjaro, Linux Mint etc.

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

It's FOSS

Making You a Better Linux User

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.