Description
The problem only occurs when I'm using antigen. If I uninstall antigen and just run autoload -U compinit; compinit
in the shell, kubectl completion works fine.
Problem
kubectl tab completion sometimes gives the following error:
_kubectl:4: bad set of key/value pairs for associative array
Steps to Reproduce (with plugins)
- Install software and dotfiles as described in Environment section.
- Cleanup
rm ~/.zcompdump; antigen reset
. - Open a new instance of zsh from the OS (not from inside the old shell).
- Type
kubectl <tab>
. - Observe the error.
Steps to Reproduce (without plugins)
- Install the software without any additional plugins, as described in the Environment section.
- Cleanup
rm ~/.zcompdump; antigen reset
. - Open a new instance of zsh from the OS (not from inside the old shell).
- Type
kubectl <tab>
. - Observe that completion appears normally.
- Run the command
antigen list
. - Type
kubectl <tab>
. - Observe the error.
Workaround
This command appears to solve the problem temporarily:
source /usr/local/share/zsh/site-functions/_kubectl
(that is actually a link to /usr/local/Cellar/kubernetes-cli/1.8.2/share/zsh/site-functions/_kubectl
, which is identical to the output of kubectl completion zsh
).
The problem is not resolved by adding that exact source line to the end of .zshrc, and the issue will recur when a new shell is opened from the OS, but it will not recur if a new shell is opened from inside the old shell.
Environment
Software
macOS 10.13, zsh 5.4.2, kubernetes-cli 1.8.2 and antigen v2.2.1 installed with Homebrew 1.3.6.
Configuration
.zshrc
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export EDITOR=code
source ~/.antigenrc
.antigenrc (with plugins)
source /usr/local/share/antigen/antigen.zsh
antigen use oh-my-zsh
antigen bundles <<EOBUNDLES
brew
cask
common-aliases
docker
encode64
gem
git
history
jsontools
kubectl
osx
perms
python
rails
ruby
zsh-users/zsh-completions
EOBUNDLES
antigen theme robbyrussell
antigen apply
.antigenrc (without plugins)
source /usr/local/share/antigen/antigen.zsh
antigen use oh-my-zsh
antigen theme robbyrussell
antigen apply