Search code examples
azureazure-devopsangular-cli

Azure CLI - Not able to download packages using az artifacts universal download


After downloading the source code from Azure Devops, we run below command to download all the packages.

az artifacts universal download --organization "https://dev.azure.com/TestLtd/" --feed "3ce80a2fe791" --name "release" --version "7.60.47" --path .

The above command was working fine few days back and now started throwing below error.

Error message:

**The command failed with an unexpected error. Here is the traceback:
[WinError 2] The system cannot find the file specified
Traceback (most recent call last):
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 663, in execute
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 718, in _run_job
  File "C:\Users\Test\.azure\cliextensions\azure-devops\azext_devops\dev\common\exception_handler.py", line 31, in azure_devops_exception_handler
    reraise(*sys.exc_info())
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\six.py", line 719, in reraise
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 697, in _run_job
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/__init__.py", line 333, in __call__
  File "D:\a\_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 121, in handler
  File "C:\Users\Test\.azure\cliextensions\azure-devops\azext_devops\dev\artifacts\universal.py", line 98, in download_package
    return artifact_tool.download_universal(organization, project, feed, name, version, path, file_filter)
  File "C:\Users\Test\.azure\cliextensions\azure-devops\azext_devops\dev\common\artifacttool.py", line 42, in download_universal
    return self.run_artifacttool(organization, args, "Downloading")
  File "C:\Users\Test\.azure\cliextensions\azure-devops\azext_devops\dev\common\artifacttool.py", line 67, in run_artifacttool
    proc = self._tool_invoker.run(command_args, new_env, initial_progress_message, _process_stderr)
  File "C:\Users\Test\.azure\cliextensions\azure-devops\azext_devops\dev\common\external_tool.py", line 74, in run
    self.start(command_args, env)
  File "C:\Users\Test\.azure\cliextensions\azure-devops\azext_devops\dev\common\external_tool.py", line 33, in start
    self._proc = subprocess.Popen(
  File "subprocess.py", line 971, in __init__
  File "subprocess.py", line 1440, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
To open a new issue, please run `az feedback`**

Any help would be much appreciated. Thanks.


Solution

  • I actually had the same error just now (and the same error a year ago).

    The error message indicates that the Python script could not find the binaries of ArtifactTool. Quickly check if you can locate the binaries with ls ~/.azure/azuredevops/cli/tools/artifacttool/*/artifacttool.

    If there are binaries there, try to check the folder ls ~/.azure/azuredevops/cli/tools/artifacttool/. Chances are, you'll have multiple folders:

    • an empty ArtifactTool_win10-x64_0.2.287/ (or very similar folder, with different version string) which is almost empty
    • and another folder that contains all binaries needed (with very cryptic name)

    If that's the case, the artifactTool is basically corrupted, but az update cannot fix it because it just checks for the folder existance and does not actually check for the correctness of the content.

    Just delete the ArtifactTool_win-x64_0.2.287/ folder and try to execute az universal download again. It should automatically fix that folder & its issues.