Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Error when running null-ls in macOS, neovim 0.8 #1156

Closed
3 tasks done
ThanhDat-Vo opened this issue Oct 4, 2022 · 6 comments
Closed
3 tasks done

Error when running null-ls in macOS, neovim 0.8 #1156

ThanhDat-Vo opened this issue Oct 4, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@ThanhDat-Vo
Copy link

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

NVIM v0.8.0-dev+377-gae02c02f1

Operating System

Osx

Minimal config

local null_ls_status_ok, null_ls = pcall(require, "null-ls")
if not null_ls_status_ok then
	return
end

-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
local formatting = null_ls.builtins.formatting
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
local diagnostics = null_ls.builtins.diagnostics

null_ls.setup({
	debug = true,
	sources = {
		-- formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
	-- 	formatting.black.with({ extra_args = { "--fast" } }),
		formatting.stylua,
		diagnostics.eslint_d.with({
      diagnostics_format = '[eslint] #{m}\n(#{c})'
    }),
    formatting.prettierd,
	}
})

Steps to reproduce

open a file

Expected behavior

no errors popup

Actual behavior

errors pop up
First error msg:
Error detected while processing FileType Autocommands for "
":
Error executing lua callback: ...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:214: cmd: expected list, got function:
0x010a5fc090
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:214: in function '_cmd_parts'
...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:281: in function 'validate_client_config'
...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:854: in function 'start_client'
...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:111: in function 'start_client'
...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:126: in function 'try_add'
...site/pack/packer/start/null-ls.nvim/lua/null-ls/init.lua:43: in function <...site/pack/packer/start/null-ls.nvim/lua/
null-ls/init.lua:42>

*Second error msg:
Error executing vim.schedule lua callback: ...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:214: cmd: expected list,
got function: 0x010a5fc090
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:214: in function '_cmd_parts'
...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:281: in function 'validate_client_config'
...r/neovim/HEAD-ae02c02/share/nvim/runtime/lua/vim/lsp.lua:854: in function 'start_client'
...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:111: in function 'start_client'
...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:126: in function 'try_add'
...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:222: in function 'retry_add'
...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:191: in function 'cb'
...ite/pack/packer/start/null-ls.nvim/lua/null-ls/utils.lua:240: in function 'for_each_bufnr'
...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:189: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>

Debug log

[TRACE Mon Oct 3 22:27:15 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Mon Oct 3 22:27:33 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:14:52 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:15:31 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:16:22 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:34:27 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:34:36 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:34:41 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:35:50 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:36:01 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:39:11 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:41:40 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:42:26 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:44:05 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:45:57 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Tue Oct 4 11:46:12 2022] ...te/pack/packer/start/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client

Help

No

Implementation help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.
@ThanhDat-Vo ThanhDat-Vo added the bug Something isn't working label Oct 4, 2022
@brymon68
Copy link

brymon68 commented Oct 4, 2022

Same exact thing has been happening to me for a week and driving me insane trying to debug

Nvim version:

$ nvim --version
NVIM v0.8.0-1210-gd367ed9b2
Build type: Release

My minimal config with formatting as original poster does.

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
    local path_sep = on_windows and "\\" or "/"
    local result = table.concat({ ... }, path_sep)
    return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
    local null_ls = require("null-ls")
    -- add only what you need to reproduce your issue

null_ls.setup({
  debug = false,
  sources = {
    null_ls.builtins.formatting.prettier.with({
      extra_filetypes = { "toml", "json", "tsx", "tsx", "jsx", "js" },
      extra_args = { "--single-quote", "--jsx-single-quote" },
    }),
    null_ls.builtins.formatting.black.with({ extra_args = { "--line-length", "79" } }),
    null_ls.builtins.formatting.stylua,
    null_ls.builtins.formatting.eslint,
    --null_ls.diagnostics.flake8,
  },
})
end

local function load_plugins()
    -- only add other plugins if they are necessary to reproduce the issue
    require("packer").startup({
        {
            "wbthomason/packer.nvim",
            {
                "jose-elias-alvarez/null-ls.nvim",
                requires = { "nvim-lua/plenary.nvim" },
                config = null_ls_config,
            },
        },
        config = {
            package_root = package_root,
            compile_path = compile_path,
        },
    })
end

if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
    load_plugins()
    require("packer").sync()
else
    load_plugins()
    require("packer").sync()
end

@jose-elias-alvarez
Copy link
Owner

#1103

@brymon68
Copy link

brymon68 commented Oct 5, 2022

Hey @jose-elias-alvarez, I appreciate your work and thank you for the link to the closed PR.

Can you provide some guidance as to how you validate this fix? Because I am running the most recent build for neovim:
NVIM v0.8.0-1210-gd367ed9b2

$ /usr/local/bin/nvim --version
NVIM v0.8.0-1210-gd367ed9b2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@Mac-1664551586262.local

And I am still having this issue with the above minimal config I pasted above. Is there something I am perhaps doing wrong? Apologies, but I am relatively new to neovim

@ThanhDat-Vo
Copy link
Author

@brymon68
I temporarily fix by installing a commit
use({ "jose-elias-alvarez/null-ls.nvim", compile = "76d0573fc159839a9c4e62a0ac4f1046845cdd50" })

@jose-elias-alvarez
Copy link
Owner

jose-elias-alvarez commented Oct 5, 2022

The error is caused by an incompatibility in your runtime files. If you are running or ever were running a dev version of Neovim, then you need to make sure that your runtime files match the version of Neovim you are currently running. This is automatically handled by the make install step listed on the Neovim wiki, but for some reason a lot of users skip this.

I don't know how you installed Neovim in the first place, but the gist of the issue is that you have old runtime files on your system, and you need to delete them.

@brymon68
Copy link

brymon68 commented Oct 5, 2022

Thanks @jose-elias-alvarez - That was helpful. Turns out I had a few artifiacts lying around in /usr/local/bin/. Sort of wish the neovim docs had something about where to place the binary, and other artifacts when you download. Perhaps that is an opportunity for me to contribute :)

Thanks again

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants