The completion function sh--cmd-completion-table in sh-script.el may use imenu--make-index-alist to create a list of candidates. But this function signals the error imenu-unavailable, if the index is empty. This is a commonly the case, e.g. if the scripts is new. Solution: Catch the error condition.