The error occurs when opening vim using vim . inside a directory with lots of files. I've tracked it down to the following lines:
https://github.com/scrooloose/nerdtree/blob/master/lib/nerdtree/tree_dir_node.vim#L240
https://github.com/scrooloose/nerdtree/blob/master/lib/nerdtree/tree_dir_node.vim#L264
When I uncomment both of these lines, the error disappears. Tracking this further, it appears that removing the redraw call inside nerdtree#echo also seems to fix the issue:
https://github.com/scrooloose/nerdtree/blob/master/autoload/nerdtree.vim#L537
For now I've simply uncommented the two lines mentioned above, but hopefully this information may allow you to advise on or create a proper fix.
Thank you so much for your work on nerdtree!
OS X 10.8.4
MacVim 70 (vim 7.4)
Any progress on this?
Same error , I'm getting while I type in my terminal vim .
vim Error detected while processing function nerdtree#checkForBrowse..184..185
Having exactly the same error.
I fix this problem, i had an error with my swp directory was not right set.
I just think the problem appear if you have another problem in your vim config
Having this issue too, although I have swap files turned off so I don't have a fix... Oddly enough, I only seem to have the problem in directories within my 'iCloud Drive' folder on OS X. Is that the case for anyone else?
Same problem here. I've solved that fixing the swap directory. In my case, it was not created.
Hi, I faced same problem. How do I solve this?
My error appeared Error detected while processing function nerdtree#checkForBrowse[9]..185[2]..186
@avatarr Thanks for the error message. That helps narrow down the function that's failing, but it's necessary that we get more context to solve the issue. Is there more text that is part of the error message, or is ..186 the end of it? What is your OS, vim version, NERDTree version? What NERDTree-specific setup do you have in your vimrc? There may be other general vim setup statements in your vimrc that are at play here too. What steps did you take to trigger the error? The more information you can provide, the better we'll be able to solve the problem you're having.
I saw this error because i had the following in my .vimrc:
set swapfile
set dir=~/.swap-files
but I had not yet created ~/.swap-files
Creating that directory solved my issue.
Ubuntu 16.04
Vim 7.4
@felixge, I've verified @djm158's, @ale-batt's, and @mauriciominella's observations and solution. If creating the swap file folder doesn't solve your issue, you can reopen this issue.
@PhilRunninger I'm having pretty much the same issue. No swap files.

@MarioRicalde, can you open a new issue for this? I think I may be onto something, but I need more information from you. Be sure to fill in the issue template as completely as possible, especially the steps to reproduce the error. In addition, please provide the value of your hidden setting: :set hidden?
I'm running on mac os x and had the same problem
I had to run on bash sudo xcodebuild -license and it fixed it
I'm on Ubuntu 18.04 and with VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41). I faced the problem after calling the following function I defined in my .vimrc:
let s:term_buf_nr = -1
function! KillTerminal()
if s:term_buf_nr != -1
let l:term_job = term_getjob(s:term_buf_nr)
call job_stop(l:term_job, "kill")
execute "bd! " . s:term_buf_nr
let s:term_buf_nr = -1
endif
endfunction
When calling :call KillTerminal() I got the following error
E16: Invalid range: call nerdtree#checkForBrowse(expand("<amatch>"))
non-deterministically. Sometimes a terminal is killed fine, sometimes I see this error. This is strange because my function seems to be completely unrelated to the NERDTree. I made sure that I had
set swapfile
set dir=~/.swap-files
in my .vimrc
@dmitrii-bundin I'm going to move this to a new issue, as your reported error doesn't match this issue's title.
Most helpful comment
I fix this problem, i had an error with my swp directory was not right set.
I just think the problem appear if you have another problem in your vim config