question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buffer does not exist when opening file

See original GitHub issue

Problems summary

I should start by saying that this was introduced by c5b0eaa606af67fccd0d0e972ae5e8f16678ef9e. It never happends in ce2a0321400ab3057d6ae03e0866541adb50a642.

Up on opening a file using nnoremap <silent><buffer><expr> l defx#is_directory() ? defx#do_action('open_tree') : defx#do_action('open') I sometimes get a “Buffer … does not exist” error. If I just hit enter I can continue, and the file is opened correctly. I’m having some difficulty finding a consitent way to reproduce this error.

I have yet to figure out how to reproduce consistently with minimal config. The error occur very frequently when working with somewhat larger folder/file sizes and my full nvim config.

This is the same problem as reported in #274 a couple of days ago.

Expected

No error should occur when opening files.

Environment Information

  • plugin version(SHA1): a7a3fc0

  • OS: Arch Linux

  • neovim/Vim version: NVIM v0.4.4

  • :checkhealth or :CheckHealth result(neovim only):

Output of :checkhealth

health#defx#check
========================================================================
## defx.nvim
  - OK: has("python3") was successful
  - OK: Python 3.6.1+ was successful

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~

## tmux
  - OK: escape-time: 0ms
  - INFO: $TERM: screen-256color

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          /usr/bin/python2 does not have the "neovim" module. :help |provider-python|
          /usr/bin/python2.7 does not have the "neovim" module. :help |provider-python|
          python2.6 not found in search path or not executable.
          /usr/bin/python is Python 3.9 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/bin/python3
  - INFO: Python version: 3.9.0
  - INFO: pynvim version: 0.4.2
  - OK: Latest pynvim is installed.

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - INFO: Node.js: v15.3.0
  - INFO: Neovim node.js host: /usr/lib/node_modules/neovim/bin/cli.js
  - WARNING: Package "neovim" is out-of-date. Installed: 4.5.0, latest: 4.9.0
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim

Minimal init.vim/vimrc

function! DoRemote(arg)
	UpdateRemotePlugins
endfunction

call plug#begin()

Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' }
nnoremap <C-n> :Defx -listed -resume<CR>

call plug#end()

autocmd FileType defx call s:defx_my_settings()
function! s:defx_my_settings() abort
        " Define mappings
        nnoremap <silent><buffer><expr> l defx#is_directory() ?
                \ defx#do_action('open_tree') : defx#do_action('open')
endfunction

Reproduce

  1. mkdir -p 123/456 && touch 123/456/789.txt && touch test.txt
  2. nvim -u init.vim .
  3. Hit ctrl-n, open a file with l
  4. Repeat step 3 until error occurs

Log file

Contents of nvim.log_py3_rplugin

2020-12-05 12:14:06,432 [INFO @ session.py:request:101] 950784 - 'Received error: [0, 'Vim:E86: Buffer 123 does not exist']
2020-12-05 12:14:06,434 [WARNING @ session.py:handler:200] 950784 - error response from request '_defx_do_action [['open', [], {'columns': 'mark:indent:icon:filename:type', 'winrelative': 'editor', 'auto_cd': False, 'prev_bufnr': 3, 'root_marker': '[in] ', 'resume': False, 'close': False, 'auto_recursive_level': 0, 'sort': 'filename', 'listed': False, 'new': False, 'ignored_files': '.*', 'focus': True, 'direction': '', 'visual_end': 0, 'winheight': 30, 'profile': False, 'preview_height': 12, 'buffer_name': 'default', 'winwidth': 90, 'filtered_files': '', 'split': 'no', 'preview_width': 40, 'visual_start': 0, 'cursor': 6, 'prev_last_bufnr': 3, 'search': '', 'prev_winid': 1000, 'wincol': 22, 'winrow': 16, 'session_file': '', 'floating_preview': False, 'vertical_preview': False, 'show_ignored_files': False, 'drives': [], 'toggle': False}]]': Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pynvim/plugin/host.py", line 102, in _wrap_function
    return fn(*args)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/__init__.py", line 39, in do_action
    self._rplugin.do_action(args)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/rplugin.py", line 39, in do_action
    view.do_action(args[0], args[1], args[2])
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/view.py", line 130, in do_action
    ret = action.do_action(self, defx, action_name, context)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/action.py", line 62, in do_action
    action.func(view, defx, context)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/kind/file.py", line 435, in _open
    view.restore_previous_buffer(view._prev_bufnr)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/view.py", line 412, in restore_previous_buffer
    self._vim.call('setreg', '#',
  File "/usr/lib/python3.9/site-packages/pynvim/api/nvim.py", line 299, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim:E86: Buffer 123 does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/pynvim/msgpack_rpc/session.py", line 195, in handler
    rv = self._request_cb(name, args)
  File "/usr/lib/python3.9/site-packages/pynvim/api/nvim.py", line 210, in filter_request_cb
    result = request_cb(name, args)
  File "/usr/lib/python3.9/site-packages/pynvim/plugin/host.py", line 124, in _on_request
    rv = handler(*args)
  File "/usr/lib/python3.9/site-packages/pynvim/plugin/host.py", line 107, in _wrap_function
    raise ErrorResponse(msg)
pynvim.msgpack_rpc.session.ErrorResponse: error caught in request handler '_defx_do_action [['open', [], {'columns': 'mark:indent:icon:filename:type', 'winrelative': 'editor', 'auto_cd': False, 'prev_bufnr': 3, 'root_marker': '[in] ', 'resume': False, 'close': False, 'auto_recursive_level': 0, 'sort': 'filename', 'listed': False, 'new': False, 'ignored_files': '.*', 'focus': True, 'direction': '', 'visual_end': 0, 'winheight': 30, 'profile': False, 'preview_height': 12, 'buffer_name': 'default', 'winwidth': 90, 'filtered_files': '', 'split': 'no', 'preview_width': 40, 'visual_start': 0, 'cursor': 6, 'prev_last_bufnr': 3, 'search': '', 'prev_winid': 1000, 'wincol': 22, 'winrow': 16, 'session_file': '', 'floating_preview': False, 'vertical_preview': False, 'show_ignored_files': False, 'drives': [], 'toggle': False}]]':
Traceback (most recent call last):
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/__init__.py", line 39, in do_action
    self._rplugin.do_action(args)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/rplugin.py", line 39, in do_action
    view.do_action(args[0], args[1], args[2])
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/view.py", line 130, in do_action
    ret = action.do_action(self, defx, action_name, context)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/action.py", line 62, in do_action
    action.func(view, defx, context)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/kind/file.py", line 435, in _open
    view.restore_previous_buffer(view._prev_bufnr)
  File "/home/matteus/.config/nvim/plugged/defx.nvim/rplugin/python3/defx/view.py", line 412, in restore_previous_buffer
    self._vim.call('setreg', '#',
  File "/usr/lib/python3.9/site-packages/pynvim/api/nvim.py", line 299, in call
    return self.request('nvim_call_function', name, args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.common.NvimError: Vim:E86: Buffer 123 does not exist

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
laughingman-hasscommented, Dec 9, 2020

perfect! can confirm it’s fixed! 😄

0reactions
Shougocommented, Dec 9, 2020

Fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve ''Cannot Create File Buffer'' errors
The Cannot Create File Buffer error may be caused by the following conditions: - The computer does not meet the minimum system requirements...
Read more >
Ring buffer "file doesn't exist" error - Ask Wireshark
Hello, I am getting an error whenever I try to run a capture using a ring buffer. Steps: 1. From the Capture window:...
Read more >
Error: Unable to create file buffer - IBM
Gentran:Director writes some temporary files to the Windows system in the C:\Documents and Settings\username\Local Settings\Temp directory on ...
Read more >
Mongoose error: Property 'Buffer' does not exist on type 'typeof ...
Go to package.json file. Change @types/node: "^16.0.0" to @types/node: "^15.6.1" and save it. Then run npm install !!
Read more >
Buffer scope variable not exists when run autocmd BufUnload
The bug is if the current buffer in current window is not the python file when quit Vim, the python file still there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found