Skip to content

bug: Getting error on LspAttach #2

Closed

Description

@farzadmf

Did you check docs and existing issues?

  • I have read all the plugin docs
  • I have searched the existing issues
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.11.15

Operating system/version

MacOS 15.7.2

Describe the bug

I'm using [a heavily customized] LazyVim for Rust, and I basically copy pasted the config from README:

  {
    'alexpasmantier/krust.nvim',
    ft = 'rust',
    opts = {
      keymap = '<leader>ck', -- Set a keymap for Rust buffers (default: false)
      float_win = {
        border = 'rounded', -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
        auto_focus = false, -- Auto-focus float (default: false)
      },
    },
  }

And when I open a Rust file, I get this error:

Error detected while processing LspAttach Autocommands for "*":
Error executing lua callback: ...farzadmf/.local/share/nvim/lazy/krust.nvim/lua/krust.lua:34: attempt to index field 'cmd' (a function value)
stack traceback:
	...farzadmf/.local/share/nvim/lazy/krust.nvim/lua/krust.lua:34: in function 'start'
	.../share/nvim/lazy/amazonq.nvim/lua/amazonq/completion.lua:121: in function 'start'
	....local/share/nvim/lazy/amazonq.nvim/lua/amazonq/init.lua:137: in function <....local/share/nvim/lazy/amazonq.nvim/lua/amazonq/init.lua:130>
	[C]: in function 'nvim_exec_autocmds'
	.../neovim/0.11.5/share/nvim/runtime/lua/vim/lsp/client.lua:1025: in function 'on_attach'
	.../neovim/0.11.5/share/nvim/runtime/lua/vim/lsp/client.lua:575: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

Steps To Reproduce

Nothing much to add here, basically:

  1. Open a Rust file

Expected Behavior

The plugin seems to be working fine (I think) despite the error, so it would be nice not to get it in the first place (eg, silence the error) ... or better yet, fix it so that it doesn't happen 🙂

Activity

  1. alexpasmantier commented on Dec 4, 2025

    @alexpasmantier
    Owner

    Hi, thanks for the report.

    Would you mind checking out #3 and see if that solves your issue?

    Thanks

  2. alexpasmantier commented on Dec 4, 2025

    @alexpasmantier
    Owner

    PS: you'll need to point to the local copy of the repository after cloning it:

    return {
      {
        dir = "~/path/to/where/you/cloned/krust.nvim/",  -- <--------------- here
        ft = "rust",
        opts = {
          keymap = "<leader>k", -- Set a keymap for Rust buffers (default: false)
          float_win = {
            border = "rounded", -- Border style: "none", "single", "double", "rounded", "solid", "shadow"
            auto_focus = true, -- Auto-focus float (default: false)
          },
        },
      },
    }
  3. farzadmf commented on Dec 4, 2025

    @farzadmf
    Author

    Hey @alexpasmantier ; thank you for your reply

    I just checked out branch = 'error-lsp-attach', and I don't get the error anymore!

  4. alexpasmantier commented on Dec 4, 2025

    @alexpasmantier
    Owner

    Great, thanks for trying that out!
    Closing this issue then 🎉

  5. farzadmf commented on Dec 4, 2025

    @farzadmf
    Author

    Great, thank you for taking care of this; I love how this shows the error; it helps me a lot personally.

    I saw on Reddit that some people were a bit on the mean side, but thank you for the plugin; it is very useful for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions