Skip to content

bug: Cannot debug in Lazyvim #448

Closed

Description

@organix7

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.2

Operating system/version

WSL 2

Describe the bug

Hey,

Since the last update of Neovim, every time I open a .java file (AutoConfiguration for the DAP), I get this error:

dap configuration failed
RPC[Error] code_name = MethodNotFound, message = "No delegateCommandHandler for vscode.java.resolveMainClass"
stack traceback:
...vim/lazy/nvim-java/lua/java-core/utils/error_handler.lua:18: in function 'error_handler'
...ui/.local/share/nvim/lazy/nvim-java/lua/async/runner.lua:25: in function 'callback'
...lazy/nvim-java/lua/java-core/ls/clients/jdtls-client.lua:73: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:681: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
11:07:10 PM msg_show.echomsg ja ERROR::"workspace/executeCommand failed! arguments: "::{
command = "vscode.java.resolveMainClass"
}::" error: "::{
code = -32601,
message = "No delegateCommandHandler for vscode.java.resolveMainClass",
= {
__tostring = <function 1>
}
}

I think a lot of new commands for DAP were added to the project. (By example: vscode.java.resolveMainClass)

If I disable java_debug_adapter, I no longer get this error in autoconfiguration of DAP, but if I try to run debugger, I encounter almost the same error. (vscode.java.startDebugSession instead of vscode.java.resolveMainClass)

Do you have the same error ?

i use JDTLS 1.54.0, java-debug-adapter 0.58.2 from Mason.

Thank you for your help :)

Steps To Reproduce

This is my config:

return {
  {
    "nvim-java/nvim-java",
    config = function()
      require("java").setup({
        java_debug_adapter = {
          enable = true,
        },
        spring_boot_tools = {
          enable = false,
        },
      })
      require("lspconfig").jdtls.setup({})
      local dap = require("dap")
      dap.configurations.java = {
        {
          mainClass = "",
          projectName = "",
          type = "java",
          request = "attach",
          name = "Debug (Attach) - Remote",
          hostName = "127.0.0.1",
          port = 5005,
        },
      }
    end,
  },
}

Expected Behavior

No error from DAP

Activity

  1. logrusx commented on Dec 10, 2025

    @logrusx
    Collaborator

    We dropped Mason support and migrated to vim.lsp API. Do not use Mason for nvim-java stuff and do not call lspconfig.jdtls.setup.

  2. s1n7ax commented on Dec 10, 2025

    @s1n7ax
    Member

    Hi, you can upgrade nvim-java then you need to change the require("lspconfig").jdtls.setup({}) statement to vim.lsp.enable('jdtls'). You can try again. Please reopen the ticket if not working

  3. organix7 commented on Dec 10, 2025

    @organix7
    Author

    Hello, thank you for the feedback.

    I found a solution, but I need to specify the vim.lsp.config for jdtls:

    return {
      {
        "nvim-java/nvim-java",
        config = function()
          require("java").setup()
          vim.lsp.config("jdtls", {
            name = "jdtls",
            cmd = { "jdtls" },
          })
          vim.lsp.enable("jdtls")
          local dap = require("dap")
    
          dap.configurations.java = {
            {
              mainClass = "",
              projectName = "",
              type = "java",
              request = "attach",
              name = "Debug (Attach) - Remote",
              hostName = "127.0.0.1",
              port = 5005,
            },
          }
        end,
      },
    }
    

    And I manually installed jdtls on my system (using the jdtls command)

    I don't know if it is the expected solution...

    If I don't specify a vim.lsp.config for jdtls, I get this warning and jdtls doesn't run:

    Warn 10:49:19 notify.warn ...im/lazy/nvim-java/lua/java-core/ls/servers/jdtls/cmd.lua:33: attempt to index local 'lsp_config' (a nil value)

    Some info in LspInfo:

    vim.lsp: Active Clients ~

    • spring-boot (id: 1)
      • Version: ? (no serverInfo.version response)
      • Root directory: ~/dev/esb/forem-service-horizons-emploi
      • Command: { "/home/guigui/.asdf/installs/java/corretto-21.0.9.11.1//bin/java", "-XX:TieredStopAtLevel=1", "-Xmx1G", "-XX:+UseZGC", "-cp", "/home/guigui/.local/share/nvim/nvim-java/packages/spring-boot-tools/1.55.1/extension/language-server/BOOT-INF/classes:/home/guigui/.local/share/nvim/nvim-java/packages/spring-boot-tools/1.55.1/extension/language-server/BOOT-INF/lib/*", "-Dsts.lsp.client=vscode", "-Dsts.log.file=/dev/null", "-Dspring.config.location=file:/home/guigui/.local/share/nvim/nvim-java/packages/spring-boot-tools/1.55.1/extension/language-server/BOOT-INF/classes/application.properties", "org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp" }
      • Settings: {
        spring_boot = {}
        }
      • Attached buffers: 11
    • copilot (id: 7)
      • Version: 1.400.0
      • Root directory: ~/dev/esb/forem-service-horizons-emploi
      • Command: { "node", "--experimental-sqlite", "/home/guigui/.local/share/nvim/lazy/copilot.lua/copilot/js/language-server.js", "--stdio" }
      • Settings: {
        telemetry = {
        telemetryLevel = "all"
        }
        }
      • Attached buffers: 11

    vim.lsp: Enabled Configurations ~

    • jdtls:
      • capabilities: {
        textDocument = {
        completion = {
        completionItem = {
        commitCharactersSupport = false,
        deprecatedSupport = true,
        documentationFormat = { "markdown", "plaintext" },
        insertReplaceSupport = true,
        insertTextModeSupport = {
        valueSet = { 1 }
        },
        labelDetailsSupport = true,
        preselectSupport = false,
        resolveSupport = {
        properties = { "documentation", "detail", "additionalTextEdits", "command", "data" }
        },
        snippetSupport = true,
        tagSupport = {
        valueSet = { 1 }
        }
        },
        completionList = {
        itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }
        },
        contextSupport = true,
        insertTextMode = 1
        }
        },
        workspace = {
        fileOperations = {
        didRename = true,
        willRename = true
        }
        }
        }

    And this page is still good ? https://github.com/nvim-java/nvim-java/wiki/Lazyvim

  4. s1n7ax commented on Dec 10, 2025

    @s1n7ax
    Member

    And this page is still good ? https://github.com/nvim-java/nvim-java/wiki/Lazyvim
    This is actually outdated. You shouldn't have to do any of this though. Do you have your config in github?

    Can you try deleting ~/.local/share/nvim/lazy directory and re-installing all plugins from scratch?

  5. organix7 commented on Dec 10, 2025

    @organix7
    Author

    With this configuration :

    return {
      {
        "nvim-java/nvim-java",
        config = function()
          require("java").setup()
          vim.lsp.enable("jdtls")
          local dap = require("dap")
    
          dap.configurations.java = {
            {
              mainClass = "",
              projectName = "",
              type = "java",
              request = "attach",
              name = "Debug (Attach) - Remote",
              hostName = "127.0.0.1",
              port = 5005,
            },
          }
        end,
      },
    }
    

    After deleting ~/.local/share/nvim/lazy, I still get this warning :

    Warn 10:49:19 notify.warn ...im/lazy/nvim-java/lua/java-core/ls/servers/jdtls/cmd.lua:33: attempt to index local 'lsp_config' (a nil value)

    And jdtls is not running.

  6. s1n7ax commented on Dec 10, 2025

    @s1n7ax
    Member

    Could you try upgrading to the latest stable version. 0.11.5. That must be it.

  7. organix7 commented on Dec 10, 2025

    @organix7
    Author

    I installed version 0.11.5 and it works well !
    Thanks for the help and the great work !

  8. reopened this on Dec 10, 2025
  9. linked a pull request that will close this issuechore: bump min nvim version to 0.11.5 #456on Dec 10, 2025
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions