ale icon indicating copy to clipboard operation
ale copied to clipboard

Error detected while proccesing function <SNR>214_VimCloseCallBack[11]..<SNR>214_VimExitCallBack[22] #172

Open madipietro opened this issue 3 years ago • 7 comments

Information

VIM version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 16 2022 12:09:56)
Included patches: 1-4106 

Operating System: ArchLinux

What went wrong

Using the terraform plugin I have an annoying error from time to time and then it disappears:

Error detected while processing function <SNR>214_VimCloseCallback[11]..<SNR>214_VimExitCallback[22]..function <SNR>214_VimCloseCallback[11]..<SNR>214_VimExitCallback[15]..<lambda>8[1]..<SNR>212_ExitCallback[28]..<SNR>211_HandleExit[24]..ale_linters#terraform#terraform#Handle:
line   17:
E716: Key not present in Dictionary: "detail"
E116: Invalid arguments for function add
Error detected while processing function <SNR>214_VimCloseCallback:
line   11:
E171: Missing :endif

Reproducing the bug

  1. Updated vim to latest version.
  2. Deleted all the plugins and reinstalled them with vim bundle.
  3. Try to use ale plugin with terraform.

:ALEInfo

Current Filetype: terraform
Available Linters: ['checkov', 'terraform', 'terraform_ls', 'terraform_lsp', 'tflint']
 Enabled Linters: ['checkov', 'terraform', 'terraform_ls', 'terraform_lsp', 'tflint']
 Ignored Linters: []
Suggested Fixers: 
 'remove_trailing_lines' - Remove all blank lines at the end of a file.
 'terraform' - Fix tf and hcl files with terraform fmt.
 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
Linter Variables:

let g:ale_terraform_checkov_executable = 'checkov'
let g:ale_terraform_checkov_options = ''
let g:ale_terraform_langserver_executable = 'terraform-lsp'
let g:ale_terraform_langserver_options = ''
let g:ale_terraform_ls_executable = 'terraform-ls'
let g:ale_terraform_ls_options = ''
let g:ale_terraform_terraform_executable = 'terraform'
let g:ale_terraform_tflint_executable = 'tflint'
let g:ale_terraform_tflint_options = ''
Global Variables:

let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_disable_lsp = 0
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'Always'
let g:ale_linter_aliases = {}
let g:ale_linters = {}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 0
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_root = {}
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = 0
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
 Command History:

(executable check - failure) checkov
(executable check - success) terraform
(finished - exit code 1) ['/usr/bin/zsh', '-c', '''terraform'' validate -no-color -json  < ''/tmp/v4lVh0t/3/variables.tf''']

<<<OUTPUT STARTS>>>
{
 "valid": false,
 "error_count": 2,
 "warning_count": 0,
 "diagnostics": [
   {
     "severity": "error",
     "summary": "Could not satisfy plugin requirements",
     "detail": "\nPlugin reinitialization required. Please run \"terraform init\".\n\nPlugins are external binaries that Terraform uses to access and manipulate\nresources. The configuration provided requires plugins which can't be located,\ndon't satisfy the version constraints, or are otherwise incompatible.\n\nTerraform automatically discovers provider requirements from your\nconfiguration, including providers used in child modules. To see the\nrequirements and constraints from each module, run \"terraform providers\".\n"
   },
   {
     "severity": "error",
     "summary": "provider.aws: no suitable version installed\n  version requirements: \"(any version)\"\n  versions installed: none"
   }
 ]
}
<<<OUTPUT ENDS>>>

(executable check - success) tflint
(finished - exit code 0) ['/usr/bin/zsh', '-c', '''tflint'' -f json ''/tmp/v4lVh0t/5/variables.tf''']

<<<OUTPUT STARTS>>>
{"issues":[],"errors":[]}
<<<OUTPUT ENDS>>>

Thanks!

madipietro avatar Feb 14 '22 17:02 madipietro

Are you using latest ALE? this was already reported in #3605 and fixed in #3606.

Problem is that some diagnostic errors returned by terraform do not have "detail" key:

   {
     "severity": "error",
     "summary": "provider.aws: no suitable version installed\n  version requirements: \"(any version)\"\n  versions installed: none"
   }

The PR #3606 check if this key is not present and uses "summary" instead.

hsanson avatar Feb 15 '22 05:02 hsanson

Are you using latest ALE? this was already reported in #3605 and fixed in #3606.

Problem is that some diagnostic errors returned by terraform do not have "detail" key:

   {
     "severity": "error",
     "summary": "provider.aws: no suitable version installed\n  version requirements: \"(any version)\"\n  versions installed: none"
   }

The PR #3606 check if this key is not present and uses "summary" instead.

Hi! @hsanson I have this on my home.

.vim/bundle/ale
on   master ❯ git status                                                                                                                 
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Checking the last commit

commit 47470eddc277e0a141e6e36a1e2a19045e051d1c (HEAD -> master, origin/master, origin/HEAD)
Author: Horacio Sanson <[email protected]>
Date:   Wed Feb 9 23:25:52 2022 +0900

    Sometimes end_lnum and end_col are not present (#4062)

M       autoload/ale/codefix.vim

I think I don't have that bugfix here.

madipietro avatar Feb 15 '22 12:02 madipietro

Are you using latest ALE? this was already reported in #3605 and fixed in #3606. Problem is that some diagnostic errors returned by terraform do not have "detail" key:

   {
     "severity": "error",
     "summary": "provider.aws: no suitable version installed\n  version requirements: \"(any version)\"\n  versions installed: none"
   }

The PR #3606 check if this key is not present and uses "summary" instead.

Hi! @hsanson I have this on my home.

.vim/bundle/ale
on   master ❯ git status                                                                                                                 
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Checking the last commit

commit 47470eddc277e0a141e6e36a1e2a19045e051d1c (HEAD -> master, origin/master, origin/HEAD)
Author: Horacio Sanson <[email protected]>
Date:   Wed Feb 9 23:25:52 2022 +0900

    Sometimes end_lnum and end_col are not present (#4062)

M       autoload/ale/codefix.vim

I think I don't have that bugfix here.

Hi @hsanson I just cloned the repo again a few seconds ago, but same error here. Is there something more that I can try to debug this issue ?

madipietro avatar Feb 15 '22 12:02 madipietro

While I agree github leaves a lot to be desired, it is actually possible to see that #3606 corresponds to the merge of commit 8c5081f. Running git branch --contains=8c5081f | grep master returns a match in my tree (where master points to the same commit as yours).

Are you sure the plugin in ~/.vim/bundle/ale/ is the one you are running? Have you tried reproducing with a minimal .vimrc configuration?

rymdbar avatar Feb 15 '22 21:02 rymdbar

While I agree github leaves a lot to be desired, it is actually possible to see that #3606 corresponds to the merge of commit 8c5081f. Running git branch --contains=8c5081f | grep master returns a match in my tree (where master points to the same commit as yours).

Are you sure the plugin in ~/.vim/bundle/ale/ is the one you are running? Have you tried reproducing with a minimal .vimrc configuration?

   ~/.vim/bundle/ale  on   master ❯ git branch --contains=8c5081f | grep master                                                                                  ✔ 
* master

My problem is always with terraform, the terraform plugin complains about Ale suddenly and IDK why, if I comment the terraform plugin the error disappears.

My vimrc.

""disable visual mode.
set mouse-=a

"for syntax
syntax on

"for enable manage unsaved buffers
set hidden

"for confirmation leaving an unsaved buffer
set confirm

"for correct right spliting
set splitright

"for yaml identation
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab

"for yaml identation guide requires indentLine plugin
let g:indentLine_char = '⦙'

"for listing buffers
set wildchar=<Tab> wildmenu wildmode=full
set wildcharm=<C-Z>
nnoremap <F10> :b <C-Z>

"for using so clipboard
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <C-r><C-o>+

"vim vundle
set nocompatible              " be iMproved, required
filetype off                  " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" alternatively, pass a path where Vundle should install plugins
call vundle#begin('~/.vim/bundle/')
"end vim vundle

"terraform
Plugin 'hashivim/vim-terraform'
let g:terraform_fmt_on_save=1
let g:terraform_align=1
"end terraform

"terraform_autocompletion
Plugin 'juliosueiras/vim-terraform-completion'
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
let g:terraform_completion_keys = 1
let g:terraform_registry_module_completion = 0
"end terraform_autocompletion

"for yaml indent
Plugin 'Yggdroot/indentLine'
"end yaml indent 

"ale
Plugin 'dense-analysis/ale'
let g:ale_terraform_terraform_executable = 'terraform'
let g:ale_terraform_tflint_executable = 'tflint'
let g:ale_terraform_tflint_options = ''
let g:ale_lint_on_text_changed = "Always"
"end ale

"syntastic
Plugin 'scrooloose/syntastic'
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_yaml_checkers = ['yamllint']
let g:syntastic_terraform_checkers = ['tflint']
let g:syntastic_terraform_tffilter_plan = 1
let g:syntastic_aggregate_errors = 1
"end syntastic

"git
Plugin 'tpope/vim-fugitive'
"end git

"Clipboard plugin
Plugin 'christoomey/vim-system-copy'
"end Clipboard plugin

"puppet
Plugin 'rodjek/vim-puppet'
"end puppet

"status
Plugin 'vim-airline/vim-airline-themes'
Plugin 'vim-airline/vim-airline'
Plugin 'powerline/powerline'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline_section_b = '%{strftime("%c")}'
let g:airline_section_y = 'BN: %{bufnr("%")}'
let g:airline#extensions#tabline#formatter = 'default'
let g:airline_statusline_ontop = 0
let g:airline_powerline_fonts = 1
"let g:airline_theme= 'violet'
let g:airline_theme= 'bubblegum'
"end status


" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required

"For clipboard
set guioptions+=a
"end For clipboard

Something wrong in here ?. Thanks in advance! @nospam2998 .

madipietro avatar Feb 15 '22 22:02 madipietro

Difficult to help here. I use terraform daily for work and cannot reproduce such issue in my setup.

You can try to debug the issue by adding output messages (e.g. echom "blah") in the problematic function: https://github.com/dense-analysis/ale/blob/master/ale_linters/terraform/terraform.vim#L27

Then use :messages to see what the output is. Output the contents of the l:error variable for example to see if it really is what ALE expects it to be.

hsanson avatar Feb 17 '22 04:02 hsanson

You might want to search through &runtimepath and see if there are any other versions of ALE installed somewhere.

w0rp avatar Mar 05 '22 01:03 w0rp

Is this still occuring for you @madipietro? Given no answer for over a year on something which very much appears to be a problem of misconfiguration, I'd say it should be safe to close this issue

rymdbar avatar Mar 07 '23 23:03 rymdbar

Is this still occuring for you @madipietro? Given no answer for over a year on something which very much appears to be a problem of misconfiguration, I'd say it should be safe to close this issue

We can close it thanks!

madipietro avatar Mar 08 '23 12:03 madipietro

@nospam2998 Thanks for helping me close a few no longer valid issues. :+1:

w0rp avatar Mar 15 '23 21:03 w0rp