Aws-cli: Error with autocompletion on macOS and ZSH

Created on 3 Jul 2020  路  9Comments  路  Source: aws/aws-cli

Confirm by changing [ ] to [x] below:

Issue is about usage on:

  • [ ] Service API : I want to do X using Y service, what should I do?
  • [ ] CLI : passing arguments or cli configurations.
  • [x] Other/Not sure.

Platform/OS/Hardware/Device

  • macOS 10.15.5 _Catalina_
  • awscli installed using brew install awscli
    _aws-cli/2.0.28 Python/3.8.3 Darwin/19.5.0 botocore/2.0.0dev32_
  • Oh My ZSH plugin aws added to .zshrc file

Describe the question
When I tab to get autocompletion, I got an error.
e.g aws cl[TAB] will result in the following error.

Logs/output

Traceback (most recent call last):
  File "/usr/local/bin/aws_completer", line 36, in <module>
    main()
  File "/usr/local/bin/aws_completer", line 28, in main
    autocomplete(command_line, command_index)
  File "/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/autocomplete/main.py", line 61, in autocomplete
    results = completer.autocomplete(command_line, position)
  File "/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/autocomplete/completer.py", line 42, in autocomplete
    parsed = self._parser.parse(command_line, index)
  File "/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/autocomplete/parser.py", line 145, in parse
    global_args = self._index.arg_names(lineage=[], command_name='aws')
  File "/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/autocomplete/local/model.py", line 104, in arg_names
    results = db.execute(self._ARG_NAME_QUERY,
  File "/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/autocomplete/db.py", line 33, in execute
    return self._connection.execute(query, kwargs)
sqlite3.OperationalError: no such table: param_table
guidance

Most helpful comment

A workaround:

I find if I copy the ac.index file (around 5.5MiB in size) from this previous commit to this path within Homebrew:

/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/data/ac.index

then TAB completion starts working again.

Something got changed in the 2.0.28 release around how this file is generated. It's either a bug in the tool itself, or possibly in the Homebrew package management.

Workaround as a script:

curl -fSL 'https://github.com/aws/aws-cli/raw/670407030f14b3454a7761b7d03262115da0eb72/awscli/data/ac.index' -o "$(brew --prefix awscli)/libexec/lib/python3.8/site-packages/awscli/data/ac.index"

All 9 comments

Exactly this as above is currently affecting me also.

A workaround:

I find if I copy the ac.index file (around 5.5MiB in size) from this previous commit to this path within Homebrew:

/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/data/ac.index

then TAB completion starts working again.

Something got changed in the 2.0.28 release around how this file is generated. It's either a bug in the tool itself, or possibly in the Homebrew package management.

Also experiencing this error using Bash.

Definitely done on purpose. I'm assume there's a step for generating the completion index that is not happening with Hombrew installs. https://github.com/aws/aws-cli/pull/5324

A workaround:

I find if I copy the ac.index file (around 5.5MiB in size) from this previous commit to this path within Homebrew:

/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/data/ac.index

then TAB completion starts working again.

Something got changed in the 2.0.28 release around how this file is generated. It's either a bug in the tool itself, or possibly in the Homebrew package management.

Workaround as a script:

curl -fSL 'https://github.com/aws/aws-cli/raw/670407030f14b3454a7761b7d03262115da0eb72/awscli/data/ac.index' -o "$(brew --prefix awscli)/libexec/lib/python3.8/site-packages/awscli/data/ac.index"

A workaround:
I find if I copy the ac.index file (around 5.5MiB in size) from this previous commit to this path within Homebrew:
/usr/local/Cellar/awscli/2.0.28/libexec/lib/python3.8/site-packages/awscli/data/ac.index
then TAB completion starts working again.
Something got changed in the 2.0.28 release around how this file is generated. It's either a bug in the tool itself, or possibly in the Homebrew package management.

Workaround as a script:

curl -fSL 'https://github.com/aws/aws-cli/raw/670407030f14b3454a7761b7d03262115da0eb72/awscli/data/ac.index' -o "$(brew --prefix awscli)/libexec/lib/python3.8/site-packages/awscli/data/ac.index"

thanks @liamdawson thanks for your workaround

I opened a PR in Homebrew to fix this: https://github.com/Homebrew/homebrew-core/pull/57547

thanks for the hint on a fix, @liamdawson

Hi @dralshehri (and others who provided a solution and opened the change at homebrew), thank you for reporting and your responses!

Since this was an issue specific to homebrew, I'm going to mark it resolved and close it. I will open a separate issue and link here as an example to provide documentation on the recommended method for building the client from source.

See #5345 for an issue tracking improving the documentation for building from source. Thanks!

Problem solved after updating awscli through homebrew.
_aws-cli/2.0.29 Python/3.8.3 Darwin/19.5.0 botocore/2.0.0dev33_

Thanks to all!

Was this page helpful?
0 / 5 - 0 ratings