Skip to content

[Bug][Windows] Error executing vim.schedule lua callback ....async.lua: The coroutine failed. #563

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

Open
searleser97 opened this issue Mar 18, 2025 · 5 comments
Labels
bug Something isn't working

Comments

@searleser97
Copy link

Description

Error executing vim.schedule lua callback: ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:187: The coroutine failed
 with this message:
        context: cur_thread=main co_thread=<thread 0x02698deff6e8> co_func=...iffview.nvim/lua/diffview/scene/views/diff/diff_vi
ew.lua:327
...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:426: attempt to index a nil value
stack traceback:
        ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua: in function 'func'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:373: in function <...ocal/nvim-data/lazy/diffview.nvim/lua/d
iffview/async.lua:358>
stack traceback:
        [C]: in function 'error'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:187: in function 'raise'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:215: in function 'step'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:247: in function 'notify_all'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:222: in function 'step'
        ...ocal/nvim-data/lazy/diffview.nvim/lua/diffview/async.lua:399: in function <...ocal/nvim-data/lazy/diffview.nvim/lua/d
iffview/async.lua:391>

Expected behavior

No response

Actual behavior

it occassionally shows the error from the description.

Steps to reproduce

Stage a file or a couple of files from the panel on the left within diffview.

Health check

Output of :checkhealth diffview

==============================================================================
diffview:                                   require("diffview.health").check()

Checking plugin dependencies ~
- OK nvim-web-devicons installed.

Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.48.1.vfs.0.1)
- WARNING Configured `hg_cmd` is not executable: 'hg'


Log info

Relevant info from :DiffviewLog
[INFO  2025-03-18 09:23:13.447 -0700] .../Local/nvim-data/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen 
[INFO  2025-03-18 09:23:15.670 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 1 files successfully (1135.784 ms)
[INFO  2025-03-18 09:23:33.894 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 1 files successfully (911.825 ms)
[INFO  2025-03-18 09:23:34.834 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 1 files successfully (1140.678 ms)
[INFO  2025-03-18 09:23:41.508 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 1 files successfully (1745.895 ms)
[INFO  2025-03-18 09:26:38.820 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 0 files successfully (775.599 ms)
[INFO  2025-03-18 09:38:17.889 -0700] .../Local/nvim-data/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen 
[INFO  2025-03-18 09:38:19.908 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 2 files successfully (1046.563 ms)
[INFO  2025-03-18 09:38:25.063 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 2 files successfully (1183.920 ms)
[INFO  2025-03-18 09:38:43.811 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 2 files successfully (1305.081 ms)
[INFO  2025-03-18 09:38:44.133 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 2 files successfully (1092.213 ms)
[INFO  2025-03-18 09:38:49.616 -0700] ...iffview.nvim/lua/diffview/scene/views/diff/diff_view.lua:488: [DiffView] Completed update for 2 files successfully (1526.261 ms)
[ERROR 2025-03-18 09:42:23.520 -0700] ...lazy/diffview.nvim/lua/diffview/vcs/adapters/hg/init.lua:53: [HgAdapter] Configured `hg_cmd` is not executable: 'hg'

Neovim version

0.11.0

Operating system and version

Windows

Minimal config

-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################

local root = vim.fn.stdpath("run") .. "/nvim/diffview.nvim"
local plugin_dir = root .. "/plugins"
vim.fn.mkdir(plugin_dir, "p")

for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

local plugins = {
  { "nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons.git" },
  { "diffview.nvim", url = "https://github.com/sindrets/diffview.nvim.git" },
  -- ##################################################################
  -- ### ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##################################################################
}

for _, spec in ipairs(plugins) do
  local install_path = plugin_dir .. "/" .. spec[1]
  if vim.fn.isdirectory(install_path) ~= 1 then
    if spec.url then
      print(string.format("Installing '%s'...", spec[1]))
      vim.fn.system({ "git", "clone", "--depth=1", spec.url, install_path })
    end
  end
  vim.opt.runtimepath:append(spec.path or install_path)
end

require("diffview").setup({
  -- ##############################################################################
  -- ### ADD DIFFVIEW.NVIM CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE ###
  -- ##############################################################################
})

vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))

-- ############################################################################
-- ### ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ############################################################################

print("Ready!")
@searleser97 searleser97 added the bug Something isn't working label Mar 18, 2025
@searleser97
Copy link
Author

Probably related to #528

@zdm
Copy link

zdm commented Apr 7, 2025

Same problem

@zdm
Copy link

zdm commented May 1, 2025

Ok, this is a problem with cygwin based git (mimgw or msys2 distributions).
It can return absolute paths in cygwin format: c:/aaa/bbb returned as /c/aaa/ccc.
So, when parse paths from the git output under Windows and relative path is expected and path starts with / - you need to convert it to the Windows form.
Something like this:

if vim.fn.has('win32') == 1 and string.sub(path, 1, 1) == '/' then
    path = string.gsub(string.sub(path, 2, 2) .. ':' .. string.sub(path, 3), '/', '\\')
end

@searleser97
Copy link
Author

Ok, this is a problem with cygwin based git (mimgw or msys2 distributions). It can return absolute paths in cygwin format: c:/aaa/bbb returned as /c/aaa/ccc. So, when parse paths from the git output under Windows and relative path is expected and path starts with / - you need to convert it to the Windows form. Something like this:

if vim.fn.has('win32') == 1 and string.sub(path, 1, 1) == '/' then
path = string.gsub(string.sub(path, 2, 2) .. ':' .. string.sub(path, 3), '/', '\')
end

@zdm it seems you found the issue, could you raise a PR with the fix ?

@zdm
Copy link

zdm commented May 1, 2025

PE: #574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants