Skip to content

attempt to call a nil value #1652

Open
Open

Description

@LvChengbin

I got this error message:

Error detected while processing function <SNR>23_debounceTimeTimerCallback[1]..<SNR>23_mapFSourceCallback[1]..<SNR>23_
distinctUntilChangedSourceCallback[14]..<SNR>23_filterSourceCallback[6]..<SNR>23_switchMapInputSourceCallback[8]..<SNR
>23_takeUntilFactory[7]..<SNR>23_mapFSource[3]..<SNR>23_filterConditionSource[3]..<SNR>23_materializeFSource[3]..<SNR>
23_createFn[11]..<SNR>22_request_create[6]..lsp#utils#step#start[1]..<SNR>168_next[9]..<lambda>85[1]..<SNR>22_ensure_f
lush[1]..lsp#utils#step#start[1]..<SNR>168_next[9]..<lambda>87[1]..<SNR>22_ensure_start[15]..<SNR>168_callback[1]..<SN
R>168_next[9]..<lambda>88[1]..<SNR>22_ensure_init[6]..<SNR>168_callback[1]..<SNR>168_next[9]..<lambda>89[1]..<SNR>22_e
nsure_conf[14]..<SNR>168_callback[1]..<SNR>168_next[9]..<lambda>90[1]..<SNR>22_ensure_open[16]..<SNR>168_callback[1]..
<SNR>168_next[9]..<lambda>91[1]..<SNR>22_ensure_changed[25]..<SNR>22_text_changes[12]..script /Users/workspace/.vim/p
lugged/vim-lsp/autoload/lsp/utils/diff.vim[43]..function <SNR>189_init_lua:
line   24:
attempt to call a nil value
vim --version
VIM - Vi IMproved 9.2 (2026 Feb 14, compiled Mar 03 2026 19:50:15)
macOS version - arm64
Included patches: 1-100
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl                 +jumplist            +sodium
+arabic              +keymap              +sound
+autocmd             +lambda              +spell
+autochdir           +langmap             +startuptime
-autoservername      +libcall             +statusline
-balloon_eval        +linebreak           -sun_workshop
+balloon_eval_term   +lispindent          +syntax
-browse              +listcmds            +tabpanel
++builtin_terms      +localmap            +tag_binary
+byte_offset         +lua                 -tag_old_static
+channel             +menu                -tag_any_white
+cindent             +mksession           -tcl
+clientserver        +modify_fname        +termguicolors
+clipboard           +mouse               +terminal
+clipboard_provider  -mouseshape          +terminfo
+cmdline_compl       +mouse_dec           +termresponse
+cmdline_hist        -mouse_gpm           +textobjects
+cmdline_info        -mouse_jsbterm       +textprop
+comments            +mouse_netterm       +timers
+conceal             +mouse_sgr           +title
+cryptv              -mouse_sysmouse      -toolbar
+cscope              +mouse_urxvt         +user_commands
+cursorbind          +mouse_xterm         +vartabs
+cursorshape         +multi_byte          +vertsplit
+dialog_con          +multi_lang          +vim9script
+diff                -mzscheme            +viminfo
+digraphs            +netbeans_intg       +virtualedit
-dnd                 +num64               +visual
-ebcdic              +packages            +visualextra
+emacs_tags          +path_extra          +vreplace
+eval                +perl                -wayland
+ex_extra            +persistent_undo     -wayland_clipboard
+extra_search        +popupwin            -wayland_focus_steal
-farsi               +postscript          +wildignore
+file_in_path        +printer             +wildmenu
+find_in_path        +profile             +windows
+float               -python              +writebackup
+folding             +python3             -X11
-footer              +quickfix            -xattr
+fork()              +reltime             -xfontset
+gettext             +rightleft           -xim
-hangul_input        +ruby                -xpm
+iconv               +scrollbind          -xsmp
+insert_expand       +signs               -xterm_clipboard
+ipv6                +smartindent         -xterm_save
+job                 +socketserver
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
 3rd user vimrc file: "~/.config/vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/opt/homebrew/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang -o vim -lm -lncurses -lsodium -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.5 -fstack-protector-strong -L/System/Library/Perl/5.34/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/python@3.14/Frameworks/Python.framework/Versions/3.14/lib/python3.14/config-3.14-darwin -lpython3.14 -framework CoreFoundation -lruby.4.0 -L/opt/homebrew/Cellar/ruby/4.0.1/lib

I did lots of research but I can't find any useful information.

Activity

  1. jorjuth commented on Mar 6, 2026

    @jorjuth

    The same here - same Vim 9.2.0100 from Homebrew.
    It worked with vim-9.2.0050 (tested on a not-updated environment), latest vim version has broken it.

  2. wjf3121 commented on Mar 9, 2026

    @wjf3121

    This is caused by Vim 9.2.0100 being compiled against Lua 5.5 (via Homebrew), while Vim's src/if_lua.c has no Lua 5.5 compatibility code. The s:init_lua() call in autoload/lsp/utils/diff.vim fails, and because there's no error handling, the entire script aborts — meaning lsp#utils#diff#compute never gets defined.

    The upstream fix belongs in Vim (if_lua.c needs LUA_VERSION_NUM >= 505 support), but vim-lsp can work around it by wrapping the Lua init in a try-catch so it gracefully falls back to the pure VimScript path:

     if s:has_lua && !exists('s:lua')
    -  call s:init_lua()
    +  try
    +    call s:init_lua()
    +  catch
    +    let s:has_lua = 0
    +  endtry
     endif

    This catches the Lua error and disables the Lua code path, so the VimScript fallback in s:FirstDifference / s:LastDifference is used instead. Functionally identical, just slightly slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions