-
-
Notifications
You must be signed in to change notification settings - Fork 173
fix(tabufline): prevent invalid buffer ID error on BufAdd event #521
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
base: v3.0
Are you sure you want to change the base?
fix(tabufline): prevent invalid buffer ID error on BufAdd event #521
Conversation
Add buffer validation before accessing bufs[1] to prevent crash when using preview features in Neo-tree, FZF-lua, or Telescope. Checks table length and buffer validity before calling nvim_buf_get_name().
|
Please let's merge this fix since the error is pretty annoying 🙏 |
|
do those preview features of those plugins not create listed buffers? if yes then they should be added in |
|
It does happen for me with |
|
@siduck: So even if preview buffers shouldn’t end up in I’m not a tabufline maintainer, so you likely have a better view on what the correct long-term handling of preview/unlisted buffers should be. This fix just ensures tabufline doesn’t crash in the meantime when encountering an unexpected or invalid buffer state. |
you're right. btw can you show a small video of this behavior? i tried the preview buffer feature of nvimtree and it doesnt cause this bug |
|
@siduck: At the moment I can’t reliably reproduce the crash on my current (main) system. I added extensive logging around BufAdd / BufEnter / BufDelete and tested aggressively with preview-heavy plugins (neo-tree previews, telescope, lazygit, etc.). In all observed cases, vim.t.bufs[1] was valid at the time tabufline accessed it, so the crash didn’t trigger. In that sense, I can understand why you’re not able to reproduce it either. I’m not 100% sure, but I believe I originally ran into this issue while working for a few days on a different machine — a significantly less powerful system, more comparable to a typical modern laptop than my main PC. I’ll be switching back to that system in the next few days and will continue observing and testing there, since these races seem to be highly environment- and timing-dependent. That might also be an interesting data point for this issue. That said, even if the crash is not easily reproducible for me right now, it has occurred on other systems as well (@abelfubu), so i think its worthy to keep an eye on it. I'll report back if I manage to reproduce it again. |
|
I can share a recording: Screen.Recording.2025-12-15.at.17.58.31.mov |
thx for sharing |
|
I just tested with a clean config and I don't have the error, so it looks like it's related to my config ... |
comment plugins one by one in your config |
Fix: Invalid buffer ID error in tabufline lazyload
Problem
nvim_buf_get_name()crashes with "Invalid buffer id" when using preview features in Neo-tree, FZF-lua, or Telescope.Error:
Reproduction:
Cause
Line 36 accesses
bufs[1]without validating:#bufs > 0)nvim_buf_is_valid())Preview buffers can cause
bufsto be empty or contain invalid buffer IDs.Solution
Add validation before accessing
bufs[1]: