Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix "error executing lua callback ... attempt to concatenate local 'method' (a table value)" #211

Closed
wants to merge 1 commit into from

Conversation

bartman
Copy link

@bartman bartman commented Nov 30, 2024

After updating my plugins I his this error, while editing a shell script. Other LSPs seem to work fine.

Error detected while processing InsertLeave Autocommands for "*":
Error executing lua callback: .../.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: attempt to concatenate local 'method' (a table value)
stack traceback:
        .../.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: in function 'notify'
        ...art/usr/neovim/share/nvim/runtime/lua/vim/lsp/client.lua:784: in function 'notify'
        ...ocal/share/nvim/lazy/none-ls.nvim/lua/null-ls/client.lua:205: in function 'notify_client'
        .../.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:149: in function 'flush'
        ....local/share/nvim/lazy/none-ls.nvim/lua/null-ls/init.lua:49: in function <....local/share/nvim/lazy/none-ls.nvim/lua/null-ls/init.lua:48>

It would seem that the method passed to dispatchers.notify() method is a table, not a string.

I have used vim.inspect(method) to convert that method table to a string before concatenation.

Problem went away, LSP working fine in bash.

…ethod' (a table value)"

After updating my plugins I his this error, while editing a shell script.  Other LSPs seem to work fine.

```
Error detected while processing InsertLeave Autocommands for "*":
Error executing lua callback: .../.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: attempt to concatenate local 'method' (a table value)
stack traceback:
        .../.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:131: in function 'notify'
        ...art/usr/neovim/share/nvim/runtime/lua/vim/lsp/client.lua:784: in function 'notify'
        ...ocal/share/nvim/lazy/none-ls.nvim/lua/null-ls/client.lua:205: in function 'notify_client'
        .../.local/share/nvim/lazy/none-ls.nvim/lua/null-ls/rpc.lua:149: in function 'flush'
        ....local/share/nvim/lazy/none-ls.nvim/lua/null-ls/init.lua:49: in function <....local/share/nvim/lazy/none-ls.nvim/lua/null-ls/init.lua:48>
```

It would seem that the `method` passed to `dispatchers.notify()` method is a table, not a string.

I have used `vim.inspect(method)` to convert that `method` table to a string before concatenation.

Problem went away, LSP working fine in bash.
@mochaaP
Copy link
Member

mochaaP commented Nov 30, 2024

I believe this is likely the same issue with #209.

Are you using nightly?

@mochaaP mochaaP closed this in e136069 Nov 30, 2024
mochaaP added a commit that referenced this pull request Nov 30, 2024
mochaaP added a commit that referenced this pull request Nov 30, 2024
mochaaP added a commit that referenced this pull request Nov 30, 2024
@mochaaP mochaaP reopened this Nov 30, 2024
@mochaaP
Copy link
Member

mochaaP commented Nov 30, 2024

I could not reproduce this (both on nightly and stable). Can you attach an example of the table in question?

Copy link
Member

@mochaaP mochaaP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method MUST be a string. see :h vim.lsp.rpc.start().

@jiangyinzuo
Copy link

jiangyinzuo commented Dec 1, 2024

if vim.fn.has("nvim-0.11") == 1 then
client:notify(method, params)
else
---@diagnostic disable-next-line: param-type-mismatch
client.notify(method, params)
end

I met the same problem. I changed the line 205 client:notify(method, params) to client.notify(method, params), then it works.

nvim -V1 -v output:

NVIM v0.11.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.1719379426
Compilation: /usr/bin/cc -g -O2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffile-prefix-map=/build/neovim-1Q4mpR/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878=. -flto=auto -ffat-lto-objects -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fdebug-prefix-map=/build/neovim-1Q4mpR/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878=/usr/src/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878-151a855c1b~ubuntu24.04.1 -O2 -g -Og -g -flto=auto -fno-fat-lto-objects -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fsigned-char -fstack-protector-strong -Wno-conversion -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=auto  -DUNIT_TESTING -D_GNU_SOURCE -DINCLUDE_GENERATED_DECLARATIONS -DUTF8PROC_STATIC -I/usr/include/luajit-2.1 -I/build/neovim-1Q4mpR/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878/.deps/usr/include -I/build/neovim-1Q4mpR/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878/build/src/nvim/auto -I/build/neovim-1Q4mpR/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878/build/include -I/build/neovim-1Q4mpR/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878/build/cmake.config -I/build/neovim-1Q4mpR/neovim-0.10.0~ubuntu1+git202411301226-c33ec2d7ce-971e32c878/src -I/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

@mochaaP
Copy link
Member

mochaaP commented Dec 1, 2024

hi @jiangyinzuo, what neovim commit are you on?

@jiangyinzuo
Copy link

hi @jiangyinzuo, what neovim commit are you on?

Oh, I updated to the latest commit and then no error occurred. Thanks.

@mochaaP
Copy link
Member

mochaaP commented Dec 1, 2024

tldr: update to latest nightly.

@mochaaP mochaaP closed this Dec 1, 2024
@bartman
Copy link
Author

bartman commented Dec 30, 2024

I updated nvim and none-ls.nvim to latest commits, and problem went away.

thank you.

@bartman bartman deleted the patch-1 branch December 30, 2024 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants