The actual error originates from __get_cword_at_cursor_by_ref in /etc/bash_completion in the code at:
if [[ "${words[cword]:0:${#cur}}" != "$cur" ]]; then
# We messed up. At least return the whole word so things keep working cur2=${words[cword]}
else cur2=${cur:0:$index}
fi
The $index in that last expression is -1 in this case.
But then the bash gets a bit deep for me to dig further.
Edited the title.
The actual error originates from __get_cword_ at_cursor_ by_ref in /etc/bash_ completion in the code at:
if [[ "${words[ cword]: 0:${#cur} }" != "$cur" ]]; then
cur2=$ {words[ cword]}
cur2=$ {cur:0: $index}
# We messed up. At least return the whole word so things keep working
else
fi
The $index in that last expression is -1 in this case.
But then the bash gets a bit deep for me to dig further.
Dave