Problem with fennel config using hotpot and lazy

I’m getting an error when running :Lazy sync, where I’m not sure if the problem is with my config, lazy, or hotpot.
The error:

Error executing vim.schedule lua callback: ...ames/.local/share/nvim/lazy/lazy.nvim/lua/lazy/async.lua:127: ...local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/lock.lua:28: assertion failed!
stack traceback:
        [C]: in function 'error'
        ...ames/.local/share/nvim/lazy/lazy.nvim/lua/lazy/async.lua:127: in function 'step'
        ...ames/.local/share/nvim/lazy/lazy.nvim/lua/lazy/async.lua:155: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

the function from lock.lua with a failing assertion:
The assertion is from this line, about halfway down:

        branch = info.branch or assert(Git.get_branch(plugin)),
function M.update()
  M.load()
  vim.fn.mkdir(vim.fn.fnamemodify(Config.options.lockfile, ":p:h"), "p")
  local f = assert(io.open(Config.options.lockfile, "wb"))
  f:write("{\n")

  -- keep disabled and cond plugins
  for name in pairs(M.lock) do
    if not (Config.spec.disabled[name] or Config.spec.ignore_installed[name]) then
      M.lock[name] = nil
    end
  end

  for _, plugin in pairs(Config.plugins) do
    if not plugin._.is_local and plugin._.installed then
      local info = assert(Git.info(plugin.dir))
      M.lock[plugin.name] = {
        branch = info.branch or assert(Git.get_branch(plugin)),
        commit = assert(info.commit, "commit is nil"),
      }
    end
  end

  ---@type string[]
  local names = vim.tbl_keys(M.lock)
  table.sort(names)

  for n, name in ipairs(names) do
    local info = M.lock[name]
    f:write(([[  %q: { "branch": %q, "commit": %q }]]):format(name, info.branch, info.commit))
    if n ~= #names then
      f:write(",\n")
    end
  end
  f:write("\n}\n")
  f:close()
end

I added vim.print(plugin.name) and it’s hotpot when the assertion fails.

Here’s the relevant parts of my config:

init.lua:


-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end

-- Bootstrap hotpot (fennel compiler)
local hotpotpath = vim.fn.stdpath("data") .. "/lazy/hotpot.nvim"
if not vim.uv.fs_stat(hotpotpath) then
	vim.notify("Bootstrapping hotpot.nvim...", vim.log.levels.INFO)
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"--single-branch",
		"--branch=v0.12.0",
		"https://github.com/rktjmp/hotpot.nvim.git",
		hotpotpath,
	})
	vim.notify("Bootstrapping hotpot.nvim... Done", vim.log.levels.INFO)
end

vim.opt.rtp:prepend(lazypath)
vim.opt.rtp:prepend(hotpotpath)

-- This allows us to write the rest of our config in fennel
require 'hotpot'
require 'config'

config.fnl:

(require :options)
; Setting <leader>, which occurs in 'mappings' needs to come before any 
; <leader> mappings in plugin configurations)
(require :mappings)
(require :lazy-config)
(require :commands)

lazy-config.fnl:

(local lazy (require :lazy))
(local plugins [ :rktjmp/hotpot.nvim ])
(lazy.setup plugins)

(there’s usually more here but I have a bunch of stuff commented out to try isolate the problem).

I’m bit stuck on how to proceed. I’m not super keen to do a deep dive into how lazy works. Anyone have any idea whether this is a problem with my config, or a bug?

I am having the exact same issue, only not with hotpot but with lazy.nvim itself when the assertion fails. Seems to pickup the commit, but then fails when asserting the branch. But when cloning lazy.nvim as specified it clones a specific commit, not a branch… Not sure how to fix this.

Just cloning with the command specified gives this output anyhow:


Receiving objects: 100% (21/21), 5.04 KiB | 5.04 MiB/s, done.
Note: switching to ‘077102c5bfc578693f12377846d427f49bc50076’.

You are in ‘detached HEAD’ state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

git switch -c

Or undo this operation with:

git switch -

Just found this issue [BUG] git integration cannot detect branch for detached HEAD · Issue #1557 · folke/lazy.nvim · GitHub. I had indeed put --depth=1 in my config which was causing issues. Maybe the --single-branch in your hotpotpath causes similar issues?