error starting LSP client: nil
Between the beta branch and master there appears to be some sort of issue.
I'm on Neovim 0.11 and I get error on startup "error starting LSP client: nil". On beta I do not.
What's odd is that the lsp client appears to have started and LSPInfo shows it. I've tried binary and nodejs for the server type - same either way.
This doesn't seem to happen on 0.10.5 - same configs, but in fairness that's a debian install and i'm on osx usually.
I don' think this has to do with downloading the binary - it seems to do that fine and I can run the downloaded js or binary fine.
I've enabled logging and when it fails it looks like this:
2025-04-03 09:09:00.061 [1] [DEBUG]: active plugin config:
{
config = {
copilot_node_command = "node",
filetypes = {
["."] = false,
cvs = false,
gitcommit = false,
gitrebase = false,
help = false,
hgcommit = false,
markdown = false,
svn = false,
yaml = false
},
logger = {
file = "/Users/geohar/.local/state/nvim/copilot-lua.log",
file_log_level = 0,
log_lsp_messages = false,
print_log_level = 3,
trace_lsp = "verbose",
trace_lsp_progress = false
},
panel = {
auto_refresh = false,
enabled = false,
keymap = {
accept = "<CR>",
jump_next = "]]",
jump_prev = "[[",
open = "<M-CR>",
refresh = "gr"
},
layout = {
position = "bottom",
ratio = 0.4
}
},
root_dir = <function 1>,
server = {
type = "binary"
},
server_opts_overrides = {},
should_attach = <function 2>,
suggestion = {
auto_trigger = false,
debounce = 75,
enabled = true,
hide_during_completion = true,
keymap = {
accept = "<M-l>",
accept_line = false,
accept_word = false,
dismiss = "<C-]>",
next = "<M-]>",
prev = "<M-[>"
}
},
workspace_folders = {}
},
get_root_dir = <function 3>,
setup = <function 4>
}
2025-04-03 09:09:00.062 [2] [DEBUG]: active LSP config (may change runtime):
{
capabilities = {
general = {
positionEncodings = { "utf-8", "utf-16", "utf-32" }
},
textDocument = {
callHierarchy = {
dynamicRegistration = false
},
codeAction = {
codeActionLiteralSupport = {
codeActionKind = {
valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }
}
},
dataSupport = true,
dynamicRegistration = true,
isPreferredSupport = true,
resolveSupport = {
properties = { "edit", "command" }
}
},
codeLens = {
dynamicRegistration = false,
resolveSupport = {
properties = { "command" }
}
},
completion = {
completionItem = {
commitCharactersSupport = false,
deprecatedSupport = true,
documentationFormat = { "markdown", "plaintext" },
preselectSupport = false,
resolveSupport = {
properties = { "additionalTextEdits", "command" }
},
snippetSupport = true,
tagSupport = {
valueSet = { 1 }
}
},
completionItemKind = {
valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }
},
completionList = {
itemDefaults = { "editRange", "insertTextFormat", "insertTextMode", "data" }
},
contextSupport = true,
dynamicRegistration = false
},
declaration = {
linkSupport = true
},
definition = {
dynamicRegistration = true,
linkSupport = true
},
diagnostic = {
dynamicRegistration = false
},
documentHighlight = {
dynamicRegistration = false
},
documentSymbol = {
dynamicRegistration = false,
hierarchicalDocumentSymbolSupport = true,
symbolKind = {
valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }
}
},
foldingRange = {
dynamicRegistration = false,
foldingRange = {
collapsedText = true
},
lineFoldingOnly = true
},
formatting = {
dynamicRegistration = true
},
hover = {
contentFormat = { "markdown", "plaintext" },
dynamicRegistration = true
},
implementation = {
linkSupport = true
},
inlayHint = {
dynamicRegistration = true,
resolveSupport = {
properties = { "textEdits", "tooltip", "location", "command" }
}
},
publishDiagnostics = {
dataSupport = true,
relatedInformation = true,
tagSupport = {
valueSet = { 1, 2 }
}
},
rangeFormatting = {
dynamicRegistration = true,
rangesSupport = true
},
references = {
dynamicRegistration = false
},
rename = {
dynamicRegistration = true,
prepareSupport = true
},
semanticTokens = {
augmentsSyntaxTokens = true,
dynamicRegistration = false,
formats = { "relative" },
multilineTokenSupport = false,
overlappingTokenSupport = true,
requests = {
full = {
delta = true
},
range = false
},
serverCancelSupport = false,
tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },
tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }
},
signatureHelp = {
dynamicRegistration = false,
signatureInformation = {
activeParameterSupport = true,
documentationFormat = { "markdown", "plaintext" },
parameterInformation = {
labelOffsetSupport = true
}
}
},
synchronization = {
didSave = true,
dynamicRegistration = false,
willSave = true,
willSaveWaitUntil = true
},
typeDefinition = {
linkSupport = true
}
},
window = {
showDocument = {
support = true
},
showMessage = {
messageActionItem = {
additionalPropertiesSupport = true
}
},
workDoneProgress = true
},
workspace = {
workspaceFolders = true
}
},
cmd = { "/Users/geohar/.local/share/nvim/lazy/copilot.lua/copilot/darwin-arm64/copilot-language-server-1.296.0", "--stdio" },
get_language_id = <function 1>,
handlers = {
["$/logTrace"] = <function 2>,
PanelSolution = <function 3>,
PanelSolutionsDone = <function 4>,
statusNotification = <function 5>,
["window/showDocument"] = <function 6>
},
init_options = {
editorInfo = {
name = "Neovim",
version = "0.11.0"
},
editorPluginInfo = {
name = "copilot.lua",
version = "1.296.0"
}
},
name = "copilot",
on_exit = <function 7>,
on_init = <function 8>,
root_dir = "/Users/geohar",
settings = {
telemetry = {
telemetryLevel = "all"
}
},
workspace_folders = { {
name = "/Users/geohar",
uri = "file:///Users/geohar"
} }
}
2025-04-03 09:09:00.064 [3] [ERROR]: error starting LSP client: nil
This actually appears to be related to auth method.
An auth token generated by gh auth token and set in GH_COPILOT_TOKEN or GITHUB_COPILOT_TOKEN does not work, whereas using the GitHub.com/device/login method does. I've tried regenerating a new token, but that still fails.
Thank you for figuring out the root cause! I will work on a fix :)
In the current version, it seems that using :Copilot auth when you have the token env variable set works.
However it does not autologin so I am investigating that part, would you mind doing a test to see if you get the same result with :Copilot auth?
I can confirm that if the env bars are not set and I use copilot with things work fine.
I'll investigate if this works now with copilot auth and the env bars set (it didn't before)
If I have GH_COPILOT_TOKEN set I still get the lsp null error at startup and doing Copilot auth claims it's authenticated with the the environment variable, but doesn't work.
So I still cannot replicate the nil error, however throughout my tests (and asking tpope maintainer of copilot.vim) that the token generated by the gh cli tool is not compatible with Copilot.
I have updated the documentation to reflect this, and added a new command to get the token out of the configuration file created when running :Copilot auth.
I am unsure if it fixes your issue or not though.
nvim 0.11 same issue [Copilot.lua] LSP client failed to start (no client ID returned)
Are you also on OSX? Can you try both with the config server.type = binary and server.type = nodejs?
yes osx, type= nodejs default cause this problem
type = binary will downloading the binary, But I've install the copilot-language-server using Mason and set it to env PATH, not sure why
if set type = binary
It cause the same [Copilot.lua] LSP client failed to start (no client ID returned) when reopen the neovim
I got the binary file
~/software/nvim/lazy/plugins/copilot.lua/copilot/darwin-arm64
I've change the plugins directory from ~/.local/share/nvim/plugins to ~/software/nvim/lazy/plugins/
Does this cause the problem?
Hmm, not sure. Try downloading it from the official LSP repo and setting the path manually. I described how to do it here on another Issue.
Hmm, not sure. Try downloading it from the official LSP repo and setting the path manually. I described how to do it here on another Issue.
Download from https://github.com/github/copilot-language-server-release/releases/tag/1.298.0 still not works,
What happens if you run it directly from the command line?
Like: ./copilot-language-server-1.298.0 --stdio for the binary and node language-server.js --stdio?
Do you got an error or does it just 'wait' with no message and you need to press CTRL-C to cancel the execution?
If I run the language server it just waits and I have to ctrl-C, that happens with or without the env var set.
Same on node and binary.
I can successfully use the permanent login method, following the steps for the env based approach however, results in the same thing - no idea why, but for now, I'll just use the permanent method.
This one bugs me as I have no idea why it behaves this way in your environment :( If ever I stumble on something I will report back here, though without a way to reproduce it I do not see how I can investigate further. I even set up automated tests with OSX hoping it would break but it passed all my tests.
I wonder if it's because I have GH_TOKEN set also (for other purposes)
If I run the language server it just waits and I have to ctrl-C, that happens with or without the env var set.
Same on node and binary.
I can successfully use the permanent login method, following the steps for the env based approach however, results in the same thing - no idea why, but for now, I'll just use the permanent method.
same
seems worked now, I'm not sure what changes
FWIW, I was getting this as a race condition on about half of Nvim starts. Adding event = "VeryLazy" to my Lazy.nvim config fixed the race condition. Not quite sure what it was racing with exactly though. 🤷
Specifically this error: [Copilot.lua] LSP client failed to start (no client ID returned)
I had lazy = false in avante config, setting it to true fixed the issue for me
The problem has come back worse unfortunately. For a while it was very stable, but now it repeatedly issues the above. I've tried setting lazy loading, disabling the AndreM222/copilot-lualine plugin,
It seems like i'd missed copilot-cmp as it was still loading at startup.
so... disabling AndreM222/copilot-lualine is needed AND you have to put lazy=true on both copilot.lua and copilot-cmp
I'd love to be able to run this without lazy loading - any ideas what the race condition might be?
I am getting the same error, the first time when i tried :Copilot auth, i wasent able to authenticate due to power cut. Now when i try to run that command i get the error "Lsp client failed to start (no clieint ID returned)". Any idea how can i fix this or remove that env variable so i can trigger the auth window again?
I recently made some changes to the way it is loaded, not sure if it helps or not this issue 🤷♂️
Hi everyone,
I ran into this issue running LazyVim with Copilot on a Mac (Apple Silicon, M2, macOS Sonoma) after a fresh install. The problem is that the latest Node.js versions require OpenSSL 3, and the Copilot plugin (or Node) could not find the correct libraries.
Here’s what worked for me:
# Install OpenSSL 3 (if not already installed)
brew install openssl@3
# Force-link OpenSSL 3 so Node.js can find the required libraries
brew link --force openssl@3
Check if the required libraries are available:
ls -l /opt/homebrew/Cellar/openssl@3/*/lib/libcrypto.3.dylib
If this file is missing, Node.js will fail to load crypto modules.
Test if Node.js can use OpenSSL:
node -p "require('crypto').randomBytes(4).toString('hex')"
If you see a random hex string, Node.js is set up correctly.
Finally, restart Neovim. Copilot and related plugins worked fine for me after this.
I have been trying to get a minimal config up to replicate this but have failed, if anyone can make it work I will gladly work on this issue :) (I do not use nvim-cmp)
The current minimal config I have which seems incomplete
vim.env.LAZY_STDPATH = ".repro_copilot-cmp"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
local plugins = {
{
"hrsh7th/nvim-cmp",
dependencies = {
-- cmp sources plugins
{
"zbirenbaum/copilot-cmp",
},
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
config = function(_, opts)
require("luasnip").config.set_config(opts)
end,
},
},
opts = {
sources = {
{ name = "copilot", priority = 600 },
},
-- experimental = {
-- ghost_text = true,
-- },
},
},
{
"zbirenbaum/copilot-cmp",
config = function()
require("copilot_cmp").setup()
end,
},
{
"zbirenbaum/copilot.lua",
config = function()
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
["*"] = true,
},
})
end,
},
}
require("lazy.minit").repro({ spec = plugins })
@AntoineGS have this issue originally and add lazy load
After your comment, I remove lazy load and never see this again
I recently made some changes to the way it is loaded, not sure if it helps or not this issue 🤷♂️
Unless someone still having issue, or I think we are good here
Thanks for the feedback! I will close this for now, if ever someone sees this issue again you feel free to reopen.
I am on Windows and I am facing the same issue, and obviously the fixes for Mac are not compatible, so I do believe this should get reopened