Metals download process gets stuck
Describe the bug
after running :MetalsInstall on a fresh setup of nvim-metals the install script gets stuck in an infinite loop. these few lines in the logs have been repeating for several hours now:
[INFO Wed 21 May 20:58:00 2025] ...local/share/nvim/lazy/nvim-metals/lua/metals/install.lua:43: Still downloading:
[INFO Wed 21 May 20:58:00 2025] ...local/share/nvim/lazy/nvim-metals/lua/metals/install.lua:43: https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/4.30.2/protobuf-java-4.30.2.jar (0.00 %, 0 / 1840468)
[INFO Wed 21 May 20:58:00 2025] ...local/share/nvim/lazy/nvim-metals/lua/metals/install.lua:43: https://repo1.maven.org/maven2/org/eclipse/platform/org.eclipse.core.resources/3.13.500/org.eclipse.core.resources-3.13.500.jar (0.00 %, 0 / 894142)
[INFO Wed 21 May 20:58:00 2025] ...local/share/nvim/lazy/nvim-metals/lua/metals/install.lua:43: https://repo1.maven.org/maven2/org/scalameta/mtags_2.13.16/1.5.3/mtags_2.13.16-1.5.3.jar (0.00 %, 0 / 2537324)
[INFO Wed 21 May 20:58:00 2025] ...local/share/nvim/lazy/nvim-metals/lua/metals/install.lua:43: https://repo1.maven.org/maven2/org/scalameta/metals_2.13/1.5.3/metals_2.13-1.5.3.jar (0.00 %, 0 / 12028248)
[INFO Wed 21 May 20:58:00 2025] ...local/share/nvim/lazy/nvim-metals/lua/metals/install.lua:43: https://repo1.maven.org/maven2/io/get-coursier/coursier-core_2.13/2.1.24/coursier-core_2.13-2.1.24.jar (0.00 %, 0 / 1406147)
[INFO Wed 21 May 20:58:00 2025] ...local/share/nvim/lazy/nvim-metals/lua/metals/install.lua:43:
steps to reproduce:
- set up nvim-metals from scratch
- have a slow internet connection
- run :MetalsInstall
- wait for the download process to freeze
Expected behavior
Metals is expected to renew failed downloads
Operating system
macOS
Version of Metals
v0.11.1
Commit of nvim-metals
latest stable build
apparently it's ommitted in the docs that one needs to run nvim under 'sudo' to install Metals. so I guess this issue can be rephrased to "put this in the documentation"
I've found a mention of 'sudo' in #673 in regards to the same issue. After trying that—due to some coincidence, probably—the download has resumed, which led me to believe this was the solution. However, the problem returned after a short while. I still haven't managed to install Metals.
Deleting coursier's cache, then rerunning :MetalsInstall helped to unblock the installation process. Error handling and/or documentation can still be improved.
If you're having a similar issue, watch the log (should be in ~/.cache/nvim/nvim-metals/nvim-metals.log). When you notice that the log has stopped progressing, or the file downloads do not progress for a while:
- kill the
csprocess - run
: MetalsInstallagain
apparently it's ommitted in the docs that one needs to run nvim under 'sudo' to install Metals. so I guess this issue can be rephrased to "put this in the documentation"
This definitely isn't true. This simply uses cs under the hood, so unless you somehow have it required that sudo is required to run any cs command, then this shouldn't be the case.