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

Errors on session restore #453

Closed
ttytm opened this issue Apr 10, 2023 · 15 comments · Fixed by #459
Closed

Errors on session restore #453

ttytm opened this issue Apr 10, 2023 · 15 comments · Fixed by #459
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed
Milestone

Comments

@ttytm
Copy link
Contributor

ttytm commented Apr 10, 2023

Description

Restoring a session often results in an error.

Those are the two observed errors:

Error executing vim.schedule lua callback: ....local/share/nvim/lazy/barbar.nvim/lua/barbar/layout.lua:121: Invalid buffer id: 7
stack traceback:
	[C]: in function 'buf_get_option'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/layout.lua:121: in function 'calculate_buffer_width'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/layout.lua:197: in function 'calculate_buffers_width'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/layout.lua:68: in function 'calculate'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/render.lua:220: in function 'open_buffers'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/render.lua:258: in function 'get_updated_buffers'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/render.lua:702: in function 'close_buffer_animated_tick'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/render.lua:121: in function 'fn'
	...local/share/nvim/lazy/barbar.nvim/lua/barbar/animate.lua:91: in function 'start'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/render.lua:118: in function 'close_buffer_animated'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/render.lua:249: in function 'get_updated_buffers'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/render.lua:702: in function 'update'
	....local/share/nvim/lazy/barbar.nvim/lua/barbar/events.lua:92: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>
Error executing vim.schedule lua callback: vim/_editor.lua:0: nvim_exec2()../home/turiiya/.local/share/nvim/sessions/__home__turiiya__Dev__vlang__vrd, line 43: Vim(bwipeout):E517: No buffers were wiped out: bwipe 11
stack traceback:
	[C]: in function 'nvim_exec2'
	vim/_editor.lua: in function 'cmd'
	...azy/neovim-session-manager/lua/session_manager/utils.lua:83: in function <...azy/neovim-session-manager/lua/session_manager/utils.lua:80>

I hoped but I could fix it on session-manager's side but had no success trying a bunch of local modifications.

To Reproduce

Unfortunately I don't have a 100% reproduction. The error isn't always happening but I'm encountering it multiple times a day when restoring sessions and using barbar as a tabline plugin. Maybe the error traceback gives enough insight for a solution, else I'll leave an update as soon as I can connect the dots what exactly is causing it.

Screenshots

After the error I'm ending up with a "buffer-tab" like this that cannot be closed and won't adapt on bufferchange.

Screenshot_20230410_122654

Informations
Neovim version: 0.9

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 10, 2023

Probably a regression in #450. I'll take a look

@Iron-E Iron-E self-assigned this Apr 10, 2023
@Iron-E Iron-E added the bug Something isn't working label Apr 10, 2023
@Iron-E Iron-E added this to the 1.6 milestone Apr 10, 2023
@ttytm
Copy link
Contributor Author

ttytm commented Apr 10, 2023

Thank you for the prompt response! Looking at the age of #450, I was encountering errors before it was merged on session restore.

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 10, 2023

That helps rule that out, thank you!

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 10, 2023

By any chance, are you using our session integration?

@ttytm
Copy link
Contributor Author

ttytm commented Apr 10, 2023

No, wasn't aware about a session integration until grepping the code-base after reading your comment. Just checked the docs for session related things prior to this.

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 10, 2023

Oops, we should probably document that. See #347. Let me know if the issue persists after integrating

Hopefully soon you won't have to write a wrapper :mksession yourself: neovim/neovim#22814

@ttytm
Copy link
Contributor Author

ttytm commented Apr 10, 2023

Thanks alot!

It looks as if #450 might play into error No.1. So it might not be a waste to look at it after all.

The second error was the one I was definitely running into before as I commented it on an session-manager issue during last week. But for this one, using the session integration looks good so far. I would just let it consolidate for a working day 😊

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 11, 2023

I wasn't able to reproduce the first error, but I'm glad to hear that the second error is gone. If you can get it to work consistently with an nvim --clean -u minimal.lua I can help more, or if you find a fix on your own you're welcome to submit a PR.

@Iron-E Iron-E added the help wanted Extra attention is needed label Apr 11, 2023
@axieax
Copy link

axieax commented Apr 12, 2023

Just wanted to add that I run into the same issue with issue 1 with neovim-session-manager, but haven't encountered issue 2 yet. I've isolated the issue down to lazy loading barbar.nvim. I'm currently using event = "VeryLazy" with lazy.nvim, and like @tobealive mentioned, it doesn't happen all the time, but quite frequently when restoring sessions. However, I don't seem to have this issue when I set lazy = false for this plugin. (update: nvm it still occurs)

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 12, 2023

Does it happen when using :mksession @axieax? We have another user reporting issues with nvim-session-manager on #454

@axieax
Copy link

axieax commented Apr 12, 2023

Using mksession, the issue does not occur if I start up with nvim -S session, but will occur if I load it afterwards with :source session

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 12, 2023

I tried it with nvim --clean, but nothing happened; I'll have to try nvim-session-manager. Thanks for trying that!

@nandafirmans
Copy link

just update the plugin today and i have the same issue. btw i'm using auto-session
image

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 13, 2023

Minimal reproduction:

vim.opt.rtp:append
{
	'~/.local/share/barbar.nvim',
	'~/.local/share/nvim/lazy/nvim-web-devicons',
	'~/.local/share/nvim/lazy/neovim-session-manager',
	'~/.local/share/nvim/lazy/plenary.nvim',
}

vim.g.barbar_auto_setup = false
require'barbar'.setup {}
require('session_manager').setup {sessions_dir = '/tmp/sessions'}

Then nvim --clean -u minimal.lua, :SessionManager load_last_session

Edit: bisected to 202e51e

@Iron-E
Copy link
Collaborator

Iron-E commented Apr 13, 2023

Should be fixed now. Let me know if the issue persists

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

Successfully merging a pull request may close this issue.

4 participants