copilot.lua icon indicating copy to clipboard operation
copilot.lua copied to clipboard

the LSP server could not download from GitHub

Open Reverier-Xu opened this issue 9 months ago • 48 comments

Version: 0e3585b

When open a file, it will produce logs:

/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:800: Spawning language server with cmd: `{ ".local/share/nvim/lazy/copilot.lua/copilot/linux-x64/copilot-language-server-1.292.0", "--stdio" }` failed. The language server is either not installed, missing from PATH, or not executable.

2025-03-27 09:54:01.602 [40] [ERROR]: LSP client failed to start (no client ID returned)
[loops]
...

I found the .local/share/nvim/lazy/copilot.lua/copilot/linux-x64/copilot-language-server-1.292.0.zip is just a txt file with one line:

Cookies must be enabled to use GitHub.

seems a download error?

Reverier-Xu avatar Mar 27 '25 01:03 Reverier-Xu

Yes the curl command to download the zip file seems to fail for some reason. I just pushed an attempt at resolving the issue, but I am really not sure if it will work so let me know if it does or not.

AntoineGS avatar Mar 27 '25 02:03 AntoineGS

0da7ebc11bf63fe0591f664430266dfc87d77dbf fails with the same reason, still not working

Reverier-Xu avatar Mar 27 '25 02:03 Reverier-Xu

Image

the original curl command seems ok

Reverier-Xu avatar Mar 27 '25 02:03 Reverier-Xu

Very odd, until we figure it out you can just extract the zip file in that same folder and the plugin will pick it up.

AntoineGS avatar Mar 27 '25 13:03 AntoineGS

Hey, I thought i was having the same issue since i also had the notification saying: [ERROR]: LSP client failed to start (no client ID returned)

But in the flood of notifications i found this one:

Image

Stating that it could not create the linux-x64 folder. I simply did an mkdir in ~/.local/share/nvim/copilot.lua/copilot/linux-x64

Restarted neovim and everything went well this time:

Image

So maybe the issue is more related to directory creation?

NicolasGB avatar Mar 27 '25 13:03 NicolasGB

@NicolasGB maybe another bug? I have this directory though.

Reverier-Xu avatar Mar 27 '25 13:03 Reverier-Xu

I had this problem and manually creating the linux-x64 directory worked for me too.

rosshadden avatar Mar 27 '25 13:03 rosshadden

I have an idea to resolve the directory issue, but the one reported in this Issue initially is not the same from what I can see.

AntoineGS avatar Mar 27 '25 13:03 AntoineGS

In my case the directory existed and the .zip file existed but nothing unzipped it, even if I removed it and tried having copilot.lua (presumably?) download it again.

This essentially hung my nvim as above -- but what fixed it here was basically just doing this myself for now, so unzip copilot-language-server-darwin-arm64-1.292.0.zip followed by mv copilot-language-server copilot-language-server-1.292.0 which seems to be the executable name expected.

Julian avatar Mar 27 '25 14:03 Julian

In my case the directory existed and the .zip file existed but nothing unzipped it, even if I removed it and tried having copilot.lua (presumably?) download it again.

This essentially hung my nvim as above -- but what fixed it here was basically just doing this myself for now, so unzip copilot-language-server-darwin-arm64-1.292.0.zip followed by mv copilot-language-server copilot-language-server-1.292.0 which seems to be the executable name expected.

This worked for me as well. Downloaded the zip from https://github.com/github/copilot-language-server-release/releases/download/1.292.0/copilot-language-server-linux-x64-1.292.0.zip

TIAcode avatar Mar 27 '25 15:03 TIAcode

For anyone having an issue with the file manipulation, could you pull the new version (just added a log), add this to your configuration:

    require("copilot").setup {
      ...
      logger = {
        file_log_level = vim.log.levels.TRACE,
      },
      ...

Then replicate the issue and post the copilot_lua.log file generated? On linux it should be in ~/.local/state/nvim/copilot-lua.log

AntoineGS avatar Mar 27 '25 15:03 AntoineGS

Issue also occurs on LazyVim on windows, downloading the exe renaming it and placing it in the directory fixes the issue, but that's a workaround

saljic-heijmans avatar Mar 27 '25 15:03 saljic-heijmans

Do you have logs? :) They are in ~\AppaData\Local\ on Windows

AntoineGS avatar Mar 27 '25 15:03 AntoineGS

When i fresh install it i get this using lazyvim package manager

'...nvim-data/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:26: Vim:2025-03-27 16:52:59.664 [1] [ERROR]: error starting LSP client: ...les/Neovim/share/nvim/runtime/lua/vim/lsp/_transport.lua:68: Spawning language server with cmd: { "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/copilot-language-server-1.292.0.exe", "--stdio" } failed. The language server is either not installed, missing from PATH, or not executable.'

i can not find any file named copilot-lua.log in my appdata unfortunately

saljic-heijmans avatar Mar 27 '25 15:03 saljic-heijmans

Did you add the configuration described here?: https://github.com/zbirenbaum/copilot.lua/issues/408#issuecomment-2758411881

AntoineGS avatar Mar 27 '25 15:03 AntoineGS

I did, but i'm also using the environment variable for windows which makes the config directory change to ~/.config instead of AppData I'm not sure whether that also influences the log files directory, because the nvim-data directory is still in AppData

saljic-heijmans avatar Mar 27 '25 15:03 saljic-heijmans

What shell are you using on Windows? I am starting to think it may have something to do with this

AntoineGS avatar Mar 27 '25 16:03 AntoineGS

I've tried with Powershell and Nushell, the folder 'nvim-data/lazy/copilot.lua/copilot' which should contain the 'win32-x64' folder and the binary only contains a '.gitignore' and 'package.json' file, I saw in the repo that you use curl to download the binary, so I tried installing that on windows to see if it will make a difference but it did not still no .exe

saljic-heijmans avatar Mar 27 '25 16:03 saljic-heijmans

I just pushed another change to use the built-in vim.fn.mkdir which should be better at handling varieties in shells and OSes.

I use Nushell on Windows and it is working OK. Let's manually enter the commands and see which one fails in this case. You will need to replace ~ with your user path as curl does not seem to like ~ to download the zip file:

curl -v -s -L -c "~/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/cookies.txt" -b "~/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/cookies.txt" -o "~/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/copilot-language-server-win32-x64-1.292.0.zip" "https://github.com/github/copilot-language-server-release/releases/download/1.292.0/copilot-language-server-win32-x64-1.292.0.zip"

And finally unzip it:

powershell -Command "Expand-Archive -Path ~/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/copilot-language-server-win32-x64-1.292.0.zip -DestinationPath ~/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64"

AntoineGS avatar Mar 27 '25 16:03 AntoineGS

After your change the win32-x64 folder get created successfully, the curl command works fine if I use full path, but doesn't work if i use - and the powershell extract command works fine, but the extracted file does not, it is called copilot-language-server.exe and the plugin expects copilot-language-server-1.292.0.exe, otherwise it doesn't start up

saljic-heijmans avatar Mar 27 '25 16:03 saljic-heijmans

If the folder is created automatically, what is the error in NeoVim? Since the commands work I would expect it to download fine through NeoVim.

AntoineGS avatar Mar 27 '25 16:03 AntoineGS

when i delete the nvim data of copilot-lua, it reinstalls it I briefly see on the bottom downloading but very quickly after that I get the error

'...nvim-data/lazy/lazy.nvim/lua/lazy/manage/task/plugin.lua:26: Vim:2025-03-27 16:52:59.664 [1] [ERROR]: error starting LSP client: ...les/Neovim/share/nvim/runtime/lua/vim/lsp/_transport.lua:68: Spawning language server with cmd: { "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/copilot-language-server-1.292.0.exe", "--stdio" } failed. The language server is either not installed, missing from PATH, or not executable.'

so I have no clue, what happened with the downloading, is there somewhere I can find the logs for that part?

saljic-heijmans avatar Mar 27 '25 16:03 saljic-heijmans

Okay I managed to get the logs

2025-03-27 18:09:22.514 [10] [ERROR]: Error downloading file: Error: [31mnu::shell::file_not_found[0m

[31m×[0m File not found ╭─[[36;1;4msource[0m:1:1] [2m1[0m │ nu · [35;1m▲[0m · [35;1m╰── [35;1mCould not access file '/s': The system cannot find the file specified. (os error 2)[0m[0m ╰────

saljic-heijmans avatar Mar 27 '25 17:03 saljic-heijmans

Can you post what comes before? It should log the command it is about to run if you set your config to trace.

AntoineGS avatar Mar 27 '25 17:03 AntoineGS

2025-03-27 18:12:06.250 [8] [TRACE]: copilot-language-server zip file not found, ensuring directory exists 2025-03-27 18:12:06.250 [9] [TRACE]: Downloading copilot-language-server with command: curl -s -L -c "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/cookies.txt" -b "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/cookies.txt" -o "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/copilot-language-server-win32-x64-1.292.0.zip" "https://github.com/github/copilot-language-server-release/releases/download/1.292.0/copilot-language-server-win32-x64-1.292.0.zip"

saljic-heijmans avatar Mar 27 '25 17:03 saljic-heijmans

hmm that looks normal to me, if you add -v after curl and run that command, does it work?

AntoineGS avatar Mar 27 '25 17:03 AntoineGS

I'm going to drive now for an hour, so I won't be able to give you quick feedback, but when I get home I will continue monitoring this conversation.

saljic-heijmans avatar Mar 27 '25 17:03 saljic-heijmans

-v did not make any difference quickly tried it out!

saljic-heijmans avatar Mar 27 '25 17:03 saljic-heijmans

-v only means verbose so it should output a log, so if you run the follow you should be able to get a log which you can post back here:

curl -v -s -L -c "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/cookies.txt" -b "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/cookies.txt" -o "C:/Users/seal1/AppData/Local/nvim-data/lazy/copilot.lua/copilot/win32-x64/copilot-language-server-win32-x64-1.292.0.zip" "https://github.com/github/copilot-language-server-release/releases/download/1.292.0/copilot-language-server-win32-x64-1.292.0.zip"

AntoineGS avatar Mar 27 '25 19:03 AntoineGS

Just hit this myself.

For those trying to get over this error and continue working, and using lazy.nvim, you can pin it to a previous / unbroken commit, e.g.:

  { "zbirenbaum/copilot.lua", commit = "99654fe9ad6cb2500c66b178a03326f75c95f176" },

minusfive avatar Mar 27 '25 19:03 minusfive