azure-cli: Fail to unpickle `msal_http_cache.bin`: EOFError: Ran out of input

Removed ~/.azure and tried again. Same issue happens:

Error: unable to get authorization token for resource manager: Error obtaining Authorization Token from the Azure CLI: Error parsing json result from the Azure CLI: Error waiting for the Azure CLI: exit status 1: ERROR: The command failed with an unexpected error. Here is the traceback:
ERROR: Ran out of input
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 658, in execute
    raise ex
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 721, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 692, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 328, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/profile/custom.py", line 77, in get_access_token
    tenant=tenant)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 383, in get_raw_token
    credential = self._create_credential(account, tenant)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/_profile.py", line 593, in _create_credential
    return identity.get_user_credential(username_or_sp_id)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/auth/identity.py", line 209, in get_user_credential
    return UserCredential(self.client_id, username, **self._msal_app_kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/auth/identity.py", line 84, in _msal_app_kwargs
    Identity._msal_http_cache = self._load_msal_http_cache()
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/auth/identity.py", line 113, in _load_msal_http_cache
    persisted_http_cache = pickle.load(f)
EOFError: Ran out of input

_Originally posted by @edvinas31 in https://github.com/Azure/azure-cli/issues/20252#issuecomment-992255336_

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I can confirm this is also happening with us, it occurs during terraform plan operations – we have to create some calls to the azure CLI to work around limitations with azurerm terraform provider, and some of them run concurrently, so that is consistent with the hypotheses above. It can often take 2-3 attempts to get a successful deploy on Azure devops agents.