Skip to content
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

Random errors on nightly #49

Closed
skoch13 opened this issue Mar 23, 2024 · 6 comments · Fixed by #52
Closed

Random errors on nightly #49

skoch13 opened this issue Mar 23, 2024 · 6 comments · Fixed by #52

Comments

@skoch13
Copy link
Contributor

skoch13 commented Mar 23, 2024

While I'm not able to find exact pattern, but sometimes opening a buffer might result in a following:

  Error  19:14:52 msg_show.lua_error Error executing vim.schedule lua callback: ...al/share/nvim/lazy/auto-save.nvim/lua/auto-save/init.lua:76: Invalid buffer id: 381
stack traceback:
	[C]: in function 'nvim_buf_get_option'
	...al/share/nvim/lazy/auto-save.nvim/lua/auto-save/init.lua:76: in function 'lfn'
	...al/share/nvim/lazy/auto-save.nvim/lua/auto-save/init.lua:36: in function ''
	vim/_editor.lua: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

NVIM v0.10.0-dev-2675+g2955c921c
Build type: RelWithDebInfo
LuaJIT 2.1.1710088188

@okuuva
Copy link
Owner

okuuva commented Mar 25, 2024

That sounds like it tried to save a buffer that can't be saved. While there are some safeguards against it, it might be that we've missed something. Could you share your auto-save.nvim config?

@skoch13
Copy link
Contributor Author

skoch13 commented Mar 25, 2024

Sure, here it is:

  {
    "okuuva/auto-save.nvim",
    cmd = "ASToggle",
    event = { "InsertLeave", "TextChanged" },
    opts = {
      execution_message = {
        enabled = false,
      },
      condition = function(buf)
        local fn = vim.fn
        local utils = require("auto-save.utils.data")

        if utils.not_in(fn.getbufvar(buf, "&filetype"), { "NeogitStatus" }) then
          return true
        end
        return false
      end,
      trigger_events = {
        immediate_save = { "FocusLost" },
        defer_save = { "CursorHold", "TextChanged", "InsertLeave" },
        cancel_defered_save = { "CursorMoved", "CursorHoldI" },
      },
      debounce_delay = 3000,
      write_all_buffers = true,
    },
  },

@skoch13
Copy link
Contributor Author

skoch13 commented Mar 26, 2024

I think I just need to add more ft to ignore. Found two more for mini.files and neogit, will see how it goes.

@primeapple
Copy link
Collaborator

This looks like the buffer that was going to be saved was either unloaded or invalid. So adding a check with nvim_buf_is_loaded({buffer}) at the beginning of the save function in init.lua would probably fix this.

@primeapple
Copy link
Collaborator

I pushed a fix to this issue. Please check it out for yourself and see if it solves your problems.

@skoch13
Copy link
Contributor Author

skoch13 commented Apr 4, 2024

@primeapple looks like it worked, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants