Error "no protocol" (MalformedURLException) when installing MySQL_MariaDB_Generic

Using board manager in a portable installation of IDE 1.8.19 I get the following error.

 no protocol: 
java.lang.RuntimeException: java.net.MalformedURLException: no protocol: 
	at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:250)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.MalformedURLException: no protocol: 
	at java.net.URL.<init>(URL.java:593)
	at java.net.URL.<init>(URL.java:490)
	at java.net.URL.<init>(URL.java:439)
	at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:60)
	at cc.arduino.contributions.DownloadableContributionsDownloader.download(DownloadableContributionsDownloader.java:56)
	at cc.arduino.contributions.libraries.LibraryInstaller.performInstall(LibraryInstaller.java:148)
	at cc.arduino.contributions.libraries.LibraryInstaller.install(LibraryInstaller.java:118)
	at cc.arduino.contributions.libraries.ui.LibraryManagerUI.lambda$onInstallPressed$4(LibraryManagerUI.java:240)
	... 1 more

How do I figure out which URL is incorrect?

I got to this because installation of that library in IDE 2.3.10 results in the following error (no info in the output window).
image

Note:
I do understand that I can probably work around it by installing a zip version.

Not an answer to your exact question but possibly the difference is that IDE 2.x validates the entire dependency graph before downloading anything, so when it sees NativeEthernet (IIRC its a library written specifically for the Teensy 4.1 board's native Ethernet controller, not published to the official library index), it refuses cleanly, while the old IDE 1.8.19 only checks each dependency as it downloads it, so it reaches NativeEthernet, finds no url for it since it does not exist in the index, and crashes instead of failing gracefully.

PS/ In Java, the no protocol error points at a call to the URL constructor where the string passed in has no scheme, no http, https, ftp, or file prefix, and can also happen when the string is empty or null. The URL class parses the string looking for a colon followed by the scheme name at the start, and if that pattern is missing it throws MalformedURLException with no protocol.

If you are using Arduino IDE 1.x, the easiest solution is to click the "Install "MySQL_MariaDB_Generic" only" button in the "Dependencies for library MySQL_MariaDB_Generic :1.7.2" dialog that opens after you click the "Install" button in Library Manager:

In this way, you avoid the installation failing due to the library author having specified a dependency on a library that is not in Library Manager:

Arduino IDE 2.x also has the equivalent dialog. However, with Arduino IDE 2.x some processing of the dependencies data specified by the library is performed prior to displaying that dialog, so this causes the process to fail before the time that dialog would appear and allow you to instruct Arduino IDE to skip the dependencies. This makes it impossible to install any library that has invalid dependency metadata.

Very true.

Probably not worth the effort in this case, but another alternative would be using Arduino CLI:

arduino-cli lib install --no-deps MySQL_MariaDB_Generic

The --no-deps flag causes the command to skip installing the dependencies specified by the library.

Thanks people

It looks like the question "How do I figure out which URL is incorrect?" can't be answered directly :wink:

OK, that might point to the NativeEthernet library which does not exist.

So those two go together; MalformedURLException as the exception and no protocol as a detail.

I did see that dialog (one can't miss it :wink:) and noticed that the NativeEthernet library was missing in there. As it's not clear from the error what is wrong I did not use the "... only" to install.

This brings a little bit the question if a library that refers to a library that does not exist in the library manager actually belongs in the library manager?

PS
I was planning to raise an issue on github of the library but here is no "new issue" button (as far as I can see). Looks like that project is abandoned.

It isn't really the right question. The "URL" in question is something like "" or null. So it wouldn't be very useful for troubleshooting the library installation failure.

As @J-M-L explained, what happens is Arduino IDE 1.x has the naive approach of doing a lookup of the url field for the dependency in the library manager index data, then simply trying to download the file from that URL without first checking to see if any data was found. So if the specified dependency is not in the index, then it tries to download from an invalid URL.

Exactly. The correct question is "which library is incorrect".

That is interesting! So it seems Arduino IDE does filter it out when generating the content of the dialog, but apparently not when performing the dependency installations.

Something to consider is that libraries often specify a dependency on libraries maintained by other parties. The library maintainer is allowed to request the removal of their library from Library Manager, and hundreds of such requests have been accommodated:

https://github.com/arduino/library-registry/issues?q=label%3A"topic%3A+removal"

So this means that a dependency can go missing through no fault of the maintainer of the dependent library. If we were to suppress libraries with missing dependencies from Library Manager, that would mean giving people the power to suppress libraries against the wishes of the library maintainer.


You might argue that there is no point in a library being in Library Manager if the dependency is missing.

For Arduino IDE 2.x users, that is a valid conclusion, since it is impossible for them to install that library. However, that should be considered a bug in Arduino IDE. Rather than investing resources into suppressing these libraries, the bug could simply be fixed.

But even if it is possible to install the library, is there any point if a dependency is missing? It depends. You could classify dependencies as follows:

  • Mandatory dependency: the dependency is required for any usage of the dependent library
  • Conditional dependency: the dependency is only required for certain usages of the dependent library
  • Examples dependency: the dependency is a dependency of the library's example sketches, not of the library codebase
  • Invalid dependency: the dependency is an error in the library metadata

So it is only in the case of a "mandatory dependency" that the absence of the dependency renders a library worthless.


Another question you might have is: why were libraries with a missing/invalid dependency allowed into Library Manager in the first place?

The automated submission handling system actually does check to see if the dependencies specified by the metadata are present in Library Manager. However, we only display a warning to the library submitter in the case where the dependency is not found. The reason it was chosen to treat this as a warning rather than an error is because we allow batch submissions of libraries, and want to support the situation where a dependent library and its dependency are submitted at the same time. If we made the passing the check for the existence of the dependency in Library Manager mandatory, then these submissions would be incorrectly blocked.

When designing the library submission handling system, my hope was that the library submitters would pay attention to the warnings reported by the submission handling system, and take action to resolve any problems these warnings identify. And in fact, I have been very happy to see that they often do so, even in the case of completely optional "best practices" suggestions from the system. However, unfortunately some do ignore the warnings. I believe that the author of this library @khoih-prog, would have paid attention to such warnings. Unfortunately, they submitted the library during the time before the current sophisticated submission handling system was in place:

so they never received such a warning.

That is correct. Unfortunately after a period of prolific library creation, @khoih-prog archived all their libraries. Maybe they were working in an unsustainable manner and ended up burning out? I do still frequently see the community using @khoih-prog's libraries, so I believe their efforts resulted in a durable legacy.

It is unfortunate that the defect in this library's metadata renders it difficult to use. Fixing the problem would have only taken a few minutes of work, but that will not be possible now that the project is abandoned. The path forward would be for a community member to fork the library and fix the problem in their fork.

From an end-user perspective it's not necessarily a library :wink:

I think that that is the case here; maybe Conditional dependency as well.
I managed to compile some examples (but maybe I already had some libraries installed, I did not look to closely).

But in my view the networking part should not really be part of a library that is written to handle database requests.

Maybe, one day, I will have the guts to do it.

This is now considered "solved".

In the general sense of the word "dependency", yes:

So the absence of the dependency will only cause compilation failures in the case where the user configured the MySQL_MariaDB_Generic library to use that dependency


However, in this context where we are talking about dependencies specified in the library metadata, the correct classification would be "invalid". The depends field on the library metadata must only contain references to libraries distributed via Library Manager. The NativeEthernet library is instead distributed as part of the "Teensy" boards platform. So this isn't a case of breakage caused by someone else removing their library from Library Manager, or changing the name. This is instead a case where placing NativeEthernet in the list of dependencies specified by the metadata was never reasonable. Doing so was objectively an error on the part of the library author.