Error on launch: Failed to launch: could not launch process: stub exited while waiting for connection: exit status 0 #95

Closed
opened 2024-08-31 19:15:34 +03:00 by exosyphon · 3 comments
exosyphon commented 2024-08-31 19:15:34 +03:00 (Migrated from github.com)

If I run this command in the terminal it connects to dlv ~/.local/share/KickstartNvim/mason/bin/dlv debug hello.go

But inside Neovim I get this error: Error on launch: Failed to launch: could not launch process: stub exited while waiting for connection: exit status 0

It seems like it cannot connect to dlv but I am unsure how to get more information or try to have it connect differently.

Config:

{
  'mfussenegger/nvim-dap',
  dependencies = {
    'rcarriga/nvim-dap-ui',
    'nvim-neotest/nvim-nio',
    'williamboman/mason.nvim',
    'jay-babu/mason-nvim-dap.nvim',
    'leoluz/nvim-dap-go',
  },
  keys = function(_, keys)
    local dap = require 'dap'
    local dapui = require 'dapui'
    return {
      { '<leader>dc', dap.continue, desc = 'Debug: Start/Continue' },
      { '<F1>', dap.step_into, desc = 'Debug: Step Into' },
      { '<F2>', dap.step_over, desc = 'Debug: Step Over' },
      { '<F3>', dap.step_out, desc = 'Debug: Step Out' },
      { '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' },
      {
        '<leader>B',
        function()
          dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ')
        end,
        desc = 'Debug: Set Breakpoint',
      },
      { '<leader>do', dapui.toggle, desc = 'Debug: See last session result.' },
      unpack(keys),
    }
  end,
  config = function()
    local dap = require 'dap'
    local dapui = require 'dapui'

    require('mason-nvim-dap').setup {
      automatic_installation = true,
      handlers = {},
      ensure_installed = {
        'delve',
      },
    }

    dapui.setup {
      -- Set icons to characters that are more likely to work in every terminal.
      --    Feel free to remove or use ones that you like more! :)
      --    Don't feel like these are good choices.
      icons = { expanded = '▾', collapsed = '▸', current_frame = '*' },
      controls = {
        icons = {
          pause = '⏸',
          play = '▶',
          step_into = '⏎',
          step_over = '⏭',
          step_out = '⏮',
          step_back = 'b',
          run_last = '▶▶',
          terminate = '⏹',
          disconnect = '⏏',
        },
      },
    }

    dap.listeners.after.event_initialized['dapui_config'] = dapui.open
    dap.listeners.before.event_terminated['dapui_config'] = dapui.close
    dap.listeners.before.event_exited['dapui_config'] = dapui.close

    require('dap-go').setup {
      delve = {
        detached = vim.fn.has 'win32' == 0,
      },
    }
  end,
}

Cmd:
:lua require('dap-go').debug_test()

If I run this command in the terminal it connects to dlv `~/.local/share/KickstartNvim/mason/bin/dlv debug hello.go` But inside Neovim I get this error: `Error on launch: Failed to launch: could not launch process: stub exited while waiting for connection: exit status 0` It seems like it cannot connect to dlv but I am unsure how to get more information or try to have it connect differently. Config: ```lua { 'mfussenegger/nvim-dap', dependencies = { 'rcarriga/nvim-dap-ui', 'nvim-neotest/nvim-nio', 'williamboman/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', 'leoluz/nvim-dap-go', }, keys = function(_, keys) local dap = require 'dap' local dapui = require 'dapui' return { { '<leader>dc', dap.continue, desc = 'Debug: Start/Continue' }, { '<F1>', dap.step_into, desc = 'Debug: Step Into' }, { '<F2>', dap.step_over, desc = 'Debug: Step Over' }, { '<F3>', dap.step_out, desc = 'Debug: Step Out' }, { '<leader>b', dap.toggle_breakpoint, desc = 'Debug: Toggle Breakpoint' }, { '<leader>B', function() dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Breakpoint', }, { '<leader>do', dapui.toggle, desc = 'Debug: See last session result.' }, unpack(keys), } end, config = function() local dap = require 'dap' local dapui = require 'dapui' require('mason-nvim-dap').setup { automatic_installation = true, handlers = {}, ensure_installed = { 'delve', }, } dapui.setup { -- Set icons to characters that are more likely to work in every terminal. -- Feel free to remove or use ones that you like more! :) -- Don't feel like these are good choices. icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, controls = { icons = { pause = '⏸', play = '▶', step_into = '⏎', step_over = '⏭', step_out = '⏮', step_back = 'b', run_last = '▶▶', terminate = '⏹', disconnect = '⏏', }, }, } dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close require('dap-go').setup { delve = { detached = vim.fn.has 'win32' == 0, }, } end, } ``` Cmd: `:lua require('dap-go').debug_test()`
starbops commented 2024-09-22 09:38:52 +03:00 (Migrated from github.com)

Is your environment macOS with Apple Silicon? If yes, you might want to check this out: delve/Documentation/installation at master · go-delve/delve

I encountered the same issue as yours and solved it with the command sudo /usr/sbin/DevToolsSecurity -enable.

Is your environment macOS with Apple Silicon? If yes, you might want to check this out: [delve/Documentation/installation at master · go-delve/delve](https://github.com/go-delve/delve/tree/master/Documentation/installation#macos-considerations) I encountered the same issue as yours and solved it with the command `sudo /usr/sbin/DevToolsSecurity -enable`.
exosyphon commented 2024-10-13 15:42:55 +03:00 (Migrated from github.com)

Yes I am on Apple Silicon. I had the developer tools enabled already.

Yes I am on Apple Silicon. I had the developer tools enabled already.
stale[bot] commented 2025-04-12 07:27:54 +03:00 (Migrated from github.com)

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
NeonXP/nvim-dap-go#95
No description provided.