Neovim Mason cannot fetch registry information

424 views Asked by At

I'm just started trying out LazyVim and was trying to figure out why I was not getting code completion for Rust. I looked at Mason and saw that it hadn't downloaded any of the packages it had been told to. Setting the mason log level to debug and running :MasonLog gives me the following errors

[ERROR 1/16/2024 22:42:28] ...m-data/lazy/mason.nvim/lua/mason-core/providers/init.lua:80: Provider "github" "get_latest_release" failed: "Expected value but found invalid token at character 1"
[DEBUG 1/16/2024 22:42:28] ...Local/nvim-data/lazy/mason.nvim/lua/mason-core/spawn.lua:80: "gh" is not executable
[DEBUG 1/16/2024 22:42:28] ...Local/nvim-data/lazy/mason.nvim/lua/mason-core/fetch.lua:37: Fetching URL "https://api.github.com/repos/mason-org/mason-registry/releases/latest"
[DEBUG 1/16/2024 22:42:28] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="curl", spawn_opts={
  args = { "-H", "Accept: application/vnd.github.v3+json; q=1.0, application/json; q=0.8", "-H", "User-Agent: mason.nvim v1.9.0 (+https://github.com/williamboman/mason.nvim)", "-fsSL", "-X", "GET", "--connect-timeout", 30, "https://api.github.com/repos/mason-org/mason-registry/releases/latest" }
}
[DEBUG 1/16/2024 22:42:28] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 27820
[DEBUG 1/16/2024 22:42:29] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=27820 exited with exit_code=35, signal=0
[DEBUG 1/16/2024 22:42:29] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:116: Spawning cmd="wget", spawn_opts={
  args = { "--header=Accept: application/vnd.github.v3+json; q=1.0, application/json; q=0.8", "--header=User-Agent: mason.nvim v1.9.0 (+https://github.com/williamboman/mason.nvim)", "-nv", "-o", "/dev/null", "-O", "-", "--timeout=30", "--method=GET", "https://api.github.com/repos/mason-org/mason-registry/releases/latest" }
}
[DEBUG 1/16/2024 22:42:29] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:162: Spawned with pid 23400
[DEBUG 1/16/2024 22:42:29] ...cal/nvim-data/lazy/mason.nvim/lua/mason-core/process.lua:148: Job pid=23400 exited with exit_code=0, signal=0
[ERROR 1/16/2024 22:42:29] ...m-data/lazy/mason.nvim/lua/mason-core/providers/init.lua:80: Provider "github" "get_latest_release" failed: "Expected value but found invalid token at character 1"
[ERROR 1/16/2024 22:42:29] ...m-data/lazy/mason.nvim/lua/mason-core/providers/init.lua:91: No provider implementation succeeded for github.get_latest_release
[ERROR 1/16/2024 22:42:29] ...ta/lazy/mason.nvim/lua/mason-registry/sources/github.lua:146: Failed to install registry GitHubRegistrySource(repo=mason-org/mason-registry). "Failed to fetch latest registry version from GitHub API."

It looks like it's failing to get information from the main repo. When I visit the URLs mentioned myself I get the json data fine. Any neovim people have an idea what is going on here?

I was expecting things to just work with LazyVim's out of the box configs, I suspect I might be missing some requirement despite having tried to download the ones mentioned on the website. I've also spent a few hours crawling the Mason lua code to try and figure out what's going on.

1

There are 1 answers

0
eroblaze On

I experienced the same problem but I just found the solution by myself. The problem is that mason and masonlsp wasn't installed completely. So what you need to do is to uninstall them and reinstall them.<space>l will open up Lazy package manager. Then look for the two packages and press <x> to uninstall them. Then <I> should fix the problem by reinstalling them. Hope this helps!