ohmyzsh: ZSH Complaints "bad set of key/value pairs for associative array" for Completion of Service Name for systemctl

Describe the bug

The zsh complaints “_systemctl_unit_state: bad set of key/value pairs for associative array” when I typed in “systemctl enable blu” and then press TAB for completion.

To Reproduce

From a clean install of ohmyzsh:

  1. Type “systemctl enable blu” (where I supposed to type “systemctl enable bluetooth.service” as completion)
  2. Press TAB
  3. See error

Expected behavior

I think the complaints “_systemctl_unit_state: bad set of key/value pairs for associative array” should not be occurred here and the command (service name) should be completed.

Screenshots and/or Recordings

$ systemctl enable blue
_systemctl_unit_state: bad set of key/value pairs for associative array
_systemctl_unit_state: bad set of key/value pairs for associative array
_systemctl_unit_state: bad set of key/value pairs for associative array

Desktop (please complete the following information):

  • OS / Distro: Arch Linux
  • Latest ohmyzsh Update?: Yes
  • ZSH Version: zsh 5.8 (x86_64-pc-linux-gnu)
  • Terminal emulator: gnome-terminal

Additional context

I’ve also tried to remove the .zcompdump* files but it still does not work.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 12
  • Comments: 15 (6 by maintainers)

Commits related to this issue

Most upvoted comments

While a fix makes it into a new release, you could redefine the _systemctl_unit_state function to only use the first two columns:

_systemctl_unit_state() {
  typeset -gA _sys_unit_state
  _sys_unit_state=( $(__systemctl list-unit-files "$PREFIX*" | awk '{print $1, $2}') )
}

While a fix makes it into a new release, you could redefine the _systemctl_unit_state function to only use the first two columns:

_systemctl_unit_state() {
  typeset -gA _sys_unit_state
  _sys_unit_state=( $(__systemctl list-unit-files "$PREFIX*" | awk '{print $1, $2}') ) }

Hi,

I have the same issue on Arch Arm where can i redefine this function?

I think copy/pasting the above function into the bottom of ~/.zshrc does the job.