Azure / Azure/azure-cli

AssertionError: Expected 1 module to load starting with 'azext_': got []

Open
#16,188 7 comments 3 reactions 1 assignee Assigned to @jiasli View on GitHub
act-platform-engineering-squad Core feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

> ### `az feedback` auto-generates most of the information requested below, as of CLI version 2.0.62

**Describe the bug**

```
CLIInternalError: The command failed with an unexpected error. Here is the traceback:
Expected 1 module to load starting with 'azext_': got []
Traceback (most recent call last):
File "C:\yfy\env\lib\site-packages\knack\cli.py", line 215, in invoke
cmd_result = self.invocation.execute(args)
File "c:\yfy\azure-cli\src\azure-cli-core\azure\cli\core\commands\__init__.py", line 509, in execute
self.commands_loader.load_command_table(args)
File "c:\yfy\azure-cli\src\azure-cli-core\azure\cli\core\__init__.py", line 436, in load_command_table
_update_command_table_from_extensions(ext_suppressions)
File "c:\yfy\azure-cli\src\azure-cli-core\azure\cli\core\__init__.py", line 307, in _update_command_table_from_extensions
check_version_compatibility(ext.get_metadata())
File "c:\yfy\azure-cli\src\azure-cli-core\azure\cli\core\extension\__init__.py", line 147, in get_metadata
azext_metadata = WheelExtension.get_azext_metadata(ext_dir)
File "c:\yfy\azure-cli\src\azure-cli-core\azure\cli\core\extension\__init__.py", line 173, in get_azext_metadata
ext_modname = get_extension_modname(ext_dir=ext_dir)
File "c:\yfy\azure-cli\src\azure-cli-core\azure\cli\core\extension\__init__.py", line 295, in get_extension_modname
"'{}': got {}".format(EXTENSIONS_MOD_PREFIX, pos_mods))
AssertionError: Expected 1 module to load starting with 'azext_': got []
```
After debugging code, I find a solution. Remove extension folder in .azure. However, a normal user is not willing to and is not able to debug code. We can have a command to repair Azure CLI and reset environment.

**To Reproduce**

**Expected behavior**

**Environment summary**

**Additional context**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.