nvim-metals icon indicating copy to clipboard operation
nvim-metals copied to clipboard

Metals download process gets stuck

Open crimzie opened this issue 7 months ago • 5 comments

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:

  1. set up nvim-metals from scratch
  2. have a slow internet connection
  3. run :MetalsInstall
  4. 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

crimzie avatar May 21 '25 19:05 crimzie

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"

crimzie avatar May 21 '25 20:05 crimzie

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.

crimzie avatar May 22 '25 06:05 crimzie

Deleting coursier's cache, then rerunning :MetalsInstall helped to unblock the installation process. Error handling and/or documentation can still be improved.

crimzie avatar May 22 '25 08:05 crimzie

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 cs process
  • run : MetalsInstall again

crimzie avatar May 22 '25 12:05 crimzie

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.

ckipp01 avatar Jun 18 '25 17:06 ckipp01