Skip to content

Path problems on Windows #3

Open

Description

@kylewanderson

When I add a worktree via this command in a windows environment:
:lua require('telescope').extensions.git_worktree.git_worktrees()

I get the following error:
Error executing luv callback: ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:271: Path must be valid: C:\Users\me\develop\bare-repo\C:/Users/me/develop/bare-repo\branch-name stack traceback: [C]: in function 'expand' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:271: in function '_create_uv_options' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:396: in function '_execute' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:448: in function 'start' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:578: in function 'v' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:244: in function '_shutdown' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:47: in function <...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:38>

It appears to successfully create the worktree however. I can see it when I use the workrees command:
:lua require('telescope').extensions.git_worktree.create_git_worktree()

However, when I try to change worktrees by selecting one from the telescope prompt, I get a different pathing error:

Error executing luv callback: ...-data/lazy/git-worktree.nvim/lua/git-worktree/status.lua:63: 1 / 2: worktree does not exists, please create it first C:/Users/me/develop/bare-repo/branch-name stack traceback: [C]: in function 'error' ...-data/lazy/git-worktree.nvim/lua/git-worktree/status.lua:63: in function 'error' ...im-data/lazy/git-worktree.nvim/lua/git-worktree/init.lua:416: in function 'cb' ...im-data/lazy/git-worktree.nvim/lua/git-worktree/init.lua:230: in function 'v' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:244: in function '_shutdown' ...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:47: in function <...ta/Local/nvim-data/lazy/plenary.nvim/lua/plenary/job.lua:38>

The directory is present, and I can manually navigate there, and git knows I'm in the corresponding branch. It appears both issues are related to paths not functioning as expected. Any help would be greatly appreciated.

Thanks!

Activity

  1. GitMurf commented on Dec 19, 2023

    @GitMurf

    I am also having issues on Windows. @polarmutex thank you for making this fork. I just wanted to confirm you still plan on maintaining and creating a v2? Thanks so much!

  2. polarmutex commented on Dec 19, 2023

    @polarmutex
    Owner

    yes, I have started v2 as a branch in this repo. It is on the backlog for a bit since I am enjoying the advent of code. But going to get back to it soon.

    I am not a Windows user, but hopefully run tests on Windows to catch any errors. I can try to look into this on main if I get some time

  3. kylewanderson commented on Dec 22, 2023

    @kylewanderson
    Author

    @polarmutex I poked around a bit trying to run tests. I'm not the most experienced in lua, I've mostly used it to configure neovim. I played around some but I wasn't able to get the tests to run. I'm happy to run them if I get some help to do so.

  4. GitMurf commented on Dec 28, 2023

    @GitMurf

    @polarmutex I see some action in your v2 branch 🎉 ;-) Is it too early to test that branch out? or is it not usable yet? Thanks for your hard work!

  5. polarmutex commented on Dec 28, 2023

    @polarmutex
    Owner

    My goal is to have something usable by the end of the week

  6. polarmutex commented on Dec 29, 2023

    @polarmutex
    Owner

    I will try to update #5 with current status, need to still add windows testing

  7. polarmutex commented on Jul 18, 2024

    @polarmutex
    Owner

    Looking for testers of my v2 on Windows. I use plenary path for all path ops and should work.

  8. kylewanderson commented on Jul 18, 2024

    @kylewanderson
    Author

    I can test it out. What lazy config should I use to pull in v2?

  9. polarmutex commented on Jul 18, 2024

    @polarmutex
    Owner

    the current v2 code is in the main branch of this repo

    so

    {
      'polarmutex/git-worktree.nvim',
      version = '^2',
      dependencies = { "nvim-lua/plenary.nvim" }
    }

    should do it

  10. GitMurf commented on Jul 20, 2024

    @GitMurf

    Looking for testers of my v2 on Windows. I use plenary path for all path ops and should work.

    I can test in a few days when I get home from vacation. Thanks for the nice work!

  11. kylewanderson commented on Jul 25, 2024

    @kylewanderson
    Author

    Has the telescope plugin been removed/modified? I had been using the telescope extension to list and create worktrees.

    Now when I execute the telescope extension command I get:
    E5108: Error executing lua [string ":lua"]:1: attempt to call field 'git_worktrees' (a nil value) stack traceback: [string ":lua"]:1: in main chunk

    Here's my lazy config.

    {
        'polarmutex/git-worktree.nvim',
        version = '^2',
        dependencies = { "nvim-lua/plenary.nvim" },
        config = function ()
          require('telescope').load_extension('git_worktree')
          vim.keymap.set('n', '<leader>gw', ":lua require('telescope').extensions.git_worktree.git_worktrees()<CR>", {silent = true})
          vim.keymap.set('n', '<leader>ga', ":lua require('telescope').extensions.git_worktree.create_git_worktree()<CR>", {silent = true})
        end
      }
    
  12. thesimonho commented on Oct 2, 2024

    @thesimonho

    had to dig through the src to find it, but the function has changed from git_worktrees() to git_worktree()

  13. kylewanderson commented on Oct 11, 2024

    @kylewanderson
    Author

    Thank you @sho-87!

    Yes, that configuration works for the telescope extension.

    @polarmutex I am no longer getting path errors on windows. However, when I make a worktree selection from the telescope extension the directory doesn't update. I stay in the directory I was already in.

    The worktree add command from the telescope extension seems to function. If I add a worktree it creates the new path and changes to that directory. I notice that the path will be relative, so if I am already in a worktree directory, and I add another worktree, It will be nested inside rather than at the root of the bare repo. I can change directory to the bare repo and then add to get around this, but it would be nice if worktrees were started from the root of the bare repo.

    requiring git-worktree directly to change worktrees works so long as you are in the root of the bare repo. e.g .require("git-worktree").switch_worktree("main")

    If I try to use it to switch worktrees from 'main' to 'develop' it doesn't work.

    It's usable for now, but some fixes would be awesome!

    Let me know if there are more scenarios you'd like me to test.

  14. polarmutex commented on May 13, 2026

    @polarmutex
    Owner

    This was generated by AI during triage.

    Triage Notes

    What we've established so far:

    • The original mixed-path-separator errors on Windows were fixed in v2 by switching to plenary path operations
    • The telescope extension API changed: use git_worktree() (not git_worktrees()) in v2
    • As of Oct 2024, two issues remain on Windows: (1) switching worktrees via telescope does not change the directory, and (2) new worktrees are created nested inside the current worktree instead of at the bare repo root

    What we still need from you (@kylewanderson or any Windows user):

    • Can you confirm whether either remaining issue (directory not changing on switch, nested worktree paths on add) is still present on the latest main?
    • If yes, does the problem occur only when starting from a non-root worktree directory, or always?
    • What does your Lazy config look like (particularly version and any hook registration)?
  15. added
    bugSomething isn't working
    needs-infoWaiting on reporter for more information
    on May 13, 2026
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 workingneeds-infoWaiting on reporter for more information

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions