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

"Invalid buffer id: 1" error when buffer loaded from last session #50

Closed
uloco opened this issue Apr 25, 2023 · 5 comments · Fixed by #51
Closed

"Invalid buffer id: 1" error when buffer loaded from last session #50

uloco opened this issue Apr 25, 2023 · 5 comments · Fixed by #51

Comments

@uloco
Copy link

uloco commented Apr 25, 2023

I get the following error, when a buffer is already open when starting ( restored from 'rmagatti/auto-session' )

image

This does not happen with version v1.0.0

@akinsho
Copy link
Owner

akinsho commented Apr 25, 2023

@uloco I've seen this sort of error from autosession before and other neovim plugins and IIRC these manifested through the first plugin loaded but weren't actually due to it. In your specific case an autocommand is being called with a buffer but when this plugin gets to using this buffer (inside the handler for the autocommand) it isn't valid. This is really fishy since the buffer passed to the autocommand should definitely exist unless some plugin is doing something unexpected, it's not normal to have to guard against the buffer passed to an autocommand still existing by the time the callback is called.

@uloco
Copy link
Author

uloco commented Apr 25, 2023

I'll investigate further but as I said it doesn't happen with v1.0.0 so I rolled back for now. It is definitely a change you introduced. Probably session management plugin is doing something weird too.

On latest tag it happens on every start.

@akinsho
Copy link
Owner

akinsho commented Apr 26, 2023

@uloco what I've tried to explain is that yes this plugin made changes between v1.0.0 and v1.1.0 but the changes are not those that I should then need further work arounds for. One of the plugins you are using is causing a race condition that these changes only just now exposed.

I've added in a sanity check which may or may not be enough, but is the most reasonable thing I can do without adding hacks around another plugins behaviour. I also have a session restoration plugin I use with this plugin but it doesn't cause any issues with this plugin

@uloco
Copy link
Author

uloco commented Apr 26, 2023

@akinsho Your last commit fixed the error at least :) Thanks.
Also which session plugin are you using? Maybe it's worth giving a try for me too

@akinsho
Copy link
Owner

akinsho commented Apr 26, 2023

Great to hear 👍🏾, I use https://github.com/olimorris/persisted.nvim, which has been pretty nice

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.

2 participants