Skip to content

nvim-unception errors on restart (nvim 0.12) #91

Description

@jamestrew

Bug

After upgrading to Neovim 0.12, <leader>rr (:restart) triggers an nvim-unception error:

Failed to source nvim-unception/plugin/main.lua
...
vim.lua connection failed: connection refused
  client.lua:21: in main chunk (sockconnect)

Root cause

nvim-unception/lua/server/server.lua calls vim.call("setenv", "NVIM_UNCEPTION_PIPE_PATH_HOST", ...) which sets the env var on the actual process environment of the running nvim instance.

When :restart is called, the new nvim process inherits this env var. It sees NVIM_UNCEPTION_PIPE_PATH_HOST pointing to the old (now dead) socket, enters client mode, and sockconnect fails.

Fix (applied in mappings.lua)

Unset the env var before restarting:

vim.fn.setenv("NVIM_UNCEPTION_PIPE_PATH_HOST", vim.NIL)
vim.cmd("restart +qall!")

Open question

Why did this start surfacing in 0.12? Likely :restart changed how it spawns the new process — possibly switched to execvp()-style replacement (fully inheriting process env) vs previously spawning a subprocess with a cleaner env. Worth investigating what changed in neovim core's restart implementation between 0.11 and 0.12.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions