Skip to content

Error executing vim. schedule lua callback: ...cker/start/nvim-tree. lua/lua/nvim-tree/renderer/init.lua:397 #925

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

Closed
an1ndra opened this issue Feb 2, 2022 · 18 comments · Fixed by #2754
Labels
bug Something isn't working

Comments

@an1ndra
Copy link

an1ndra commented Feb 2, 2022

OS
Pop os 21.10

Neovim version

NVIM v0.6.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by [email protected]

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Nvim-tree version
master branch

Describe the bug
Every time I try to open nvim-tree this error show. and no icon, files and folder show. Screenshot from 2022-02-02 21-47-25

To Reproduce
Use any nvim-tree command example NvimTreeRefresh, NvimTreeOpen

Expected behavior
Nvim Tree should be open without any error

@sbock17
Copy link

sbock17 commented Feb 3, 2022

+1 I have exactly the same issue!

@kyazdani42
Copy link
Member

cannot reproduce this, do you have newlines in your filenames ?

@sbock17
Copy link

sbock17 commented Feb 3, 2022

The fastest method for reproduction is e.g. just installing lunarvim, I deleted all the configs (from .local/share and .config), and I get the error directly upon start now. Its strange since it only happened since this morning …

Error executing vim.schedule lua callback: ...cker/start/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:397: String cannot contain newlines
stack traceback:
        [C]: in function 'nvim_buf_set_lines'
        ...cker/start/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:397: in function 'draw'
        ...te/pack/packer/start/nvim-tree.lua/lua/nvim-tree/lib.lua:49: in function 'redraw'
        ...te/pack/packer/start/nvim-tree.lua/lua/nvim-tree/lib.lua:28: in function 'callback'
        ...ck/packer/start/nvim-tree.lua/lua/nvim-tree/git/init.lua:77: in function 'on_end'
        .../packer/start/nvim-tree.lua/lua/nvim-tree/git/runner.lua:68: in function 'on_finish'
        .../packer/start/nvim-tree.lua/lua/nvim-tree/git/runner.lua:77: in function 'cb'
        vim.lua:285: in function <vim.lua:285>

So in line 397 is the following:

  api.nvim_buf_set_lines(view.View.bufnr, 0, -1, false, lines)

The checkhealth does not even have nvim-tree mentioned and it all seems alright.

One strange thing though, is that I can not access any folder for my user (e.g. /home/test/)

But, I can activate nvim-tree and open folders that are on my usb stick - thats really strange.. I hope a solution can be found, I can (sort of) live with that in the moment, but now I can't navigate on my .config folder with nvim-tree …

@kyazdani42 The message comes without even opening a specific file, just running nvim / lvim in a folder which is in any home directory produces this error, regardless of the contents from files. When I start from a directory in a external harddrive, it works.

Another Edit and a hint:

When I use :Lexplore, then focus on lvim pane right, and when I then refocus the pane on the left from :Lexplore, the window becomes nvim-tree instead :Lexplore - but under one condition - it works only, if I navigated into a specific folder with :Lexplore. The default folder for :lexplore is just the /home/user directory.

So if I navigate into the ~/.config/nvim/ directory with :Lexplore, then focus the nvim buffer on the right, then refocus the :Lexplore buffer, it transforms into nvim-tree with its icons and functions. After this, I can close and also reopen the nvim-tree buffer again.

So with this workaround, nvim-tree still works for a session. So it has to do with setting a current working directory maybe? I hope someone else with better knowledge can reproduce, must be a bug somehow.

Any solutions found @meanindra ?

@sbock17
Copy link

sbock17 commented Feb 4, 2022

For me it's working again, don't really know what caused the issue.
It worked since I deleted the compiled file from packer in plugin folder, running :PackerCompile, :PackerSync, and :Packer Update

It's strange because I had tried it before, but now it works again like a charm!

@kyazdani42
Copy link
Member

might be an issue with the lunarvim config maybe ? i'm not sure. Or maybe conflicting with another plugin.

@alex-courtis
Copy link
Member

@meanindra perhaps you could provide a reproducible test case:

Start with the minimal config as per the bug report template: https://github.com/kyazdani42/nvim-tree.lua/issues/new/choose

Add your nvim-tree config. If you still cannot reproduce, add your plugins and their configuration until you can reproduce.

Post that modified minimal config and we can attempt to reproduce that.

@alex-courtis alex-courtis added the bug Something isn't working label Apr 3, 2022
@zamboney
Copy link

I had the same problem and (after i reinstall neovim and nvim-tree) the issue didn't solve!

finally i figure out the problem. it's seem that i had one file the contain newline in it.

so in order to reproduce this issue all you need to do is create a file that contain a newline and the error thrown.

example:

touch file$'\n'

hope it's will help 😄

@kyazdani42
Copy link
Member

is it even a good idea for a filename to contain newlines 😄 ? I guess we shouldn't crash though, but still it's a bit weird.

@alex-courtis
Copy link
Member

Closing due to inactivity.

@Oumar-1
Copy link

Oumar-1 commented Mar 19, 2023

i have the same error but i have fixed by just commenting
ignore_list at update_focued_file

i don't why it works but it does
update_focused_file = { enable = true, update_cwd = true, --[[ ignore_list = { "/node_modules" }, ]] },

@Samgarr
Copy link

Samgarr commented Apr 22, 2024

Hello, i m also experiencing this issue. I can confirm that crash is cause by newline in file name. In my case, file with newline in name was created by mistake and i am convinced that it should not lead to crash of nvim-tree.

Error executing Lua callback: .../share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: Vim:Error executing Lua callback: .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:23: 'replacement string' 
item contains newlines                                                                                                                                                                                               
stack traceback:                                                                                                                                                                                                     
        [C]: in function 'nvim_buf_set_lines'                                                                                                                                                                        
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:23: in function '_draw'                                                                                                                          
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:59: in function 'draw'                                                                                                                           
        ...ocal/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/lib.lua:195: in function 'open_view_and_draw'                                                                                                            
        ...ocal/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/lib.lua:259: in function 'open'                                                                                                                          
        ...m/lazy/nvim-tree.lua/lua/nvim-tree/actions/tree/open.lua:32: in function 'open'                                                                                                                           
        ...share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/commands.lua:51: in function <...share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/commands.lua:50>                                                                 
        [C]: in function 'cmd'                                                                                                                                                                                       
        .../share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: in function <.../share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:16>                                                                 
stack traceback:                                                                                                                                                                                                     
        [C]: in function 'cmd'                                                                                                                                                                                       
        .../share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:48: in function <.../share/nvim/lazy/lazy.nvim/lua/lazy/core/handler/cmd.lua:16> 
VIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742


nvim-tree: v1.3.0

@alex-courtis
Copy link
Member

Replicated with touch foo$'\n'bar

@alex-courtis
Copy link
Member

This should be resolved - displaying, opening and renaming files.

I'd be grateful if you tested a fix @Samgarr

cd /path/to/nvim-tree.lua
git pull
git checkout 925-handle-newlines-in-file-names

When you're finished testing:

git checkout master

@alex-courtis
Copy link
Member

@Samgarr I'd be grateful for your testing this, as it's operating system dependent.

@Samgarr
Copy link

Samgarr commented May 1, 2024

Sorry for late response, i didn't notice the notification. I can confirm that the fix works for me.

@AlejandroSanchez90
Copy link

AlejandroSanchez90 commented Oct 4, 2024

is this merged ? im having same issue

stack traceback:
        [C]: in function 'nvim_buf_set_lines'
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:51: in function '_draw'
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:114: in function 'draw'
        ...nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/watch.lua:82: in function 'callback'
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:231: in function 'callback'
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:298: in function 'callback'
        ...share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/git/init.lua:92: in function 'reload_project'
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:297: in function 'reload_and_get_git_project'
        .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/init.lua:226: in function 'refresh_node'
        ...nvim/lazy/nvim-tree.lua/lua/nvim-tree/explorer/watch.lua:81: in function 'callback'
        ...al/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/utils.lua:455: in function <...al/share/nvim/lazy/nvim-tree.lua/lua/nvim-tree/utils.lua:454>
        [C]: in function 'wait'
        ...ocal/share/nvim/lazy/conform.nvim/lua/conform/runner.lua:667: in function 'format_lines_sync'
        ...ocal/share/nvim/lazy/conform.nvim/lua/conform/runner.lua:607: in function 'format_sync'
        ....local/share/nvim/lazy/conform.nvim/lua/conform/init.lua:516: in function 'run_cli_formatters'

Error executing vim.schedule lua callback: .../nvim/lazy/nvim-tree.lua/lua/nvim-tree/renderer/init.lua:51: Keyboard interrupt

@alex-courtis
Copy link
Member

alex-courtis commented Oct 5, 2024

The fix has been release.

Please attempt the trivial test:

touch foo$'\n'bar

Please provide a reproducer for your case @AlejandroSanchez90 :a new bug report would be most gratefully appreciated.

@AlejandroSanchez90
Copy link

The fix has been release.

Please attempt the trivial test:

touch foo$'\n'bar

Please provide a reproducer for your case @AlejandroSanchez90 :a new bug report would be most gratefully appreciated.

I fixed my issue by adding node module folder to the ignore list for tracked files

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

Successfully merging a pull request may close this issue.

8 participants