Azure / Azure/azure-cli

Bicep CLI 0.23.1 does not work on Apple Silicon (ERROR: [Errno 86] Bad CPU type in executable)

Open
#27,758 8 comments 0 reactions 0 assignees View on GitHub
act-identity-squad ARM Auto-Assign Auto-Resolve bug customer-reported Possible-Solution Service Attention Similar-Issue
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

I just ran `az bicep upgrade` and now I get this error:
`Debug: output = ERROR: [Errno 86] Bad CPU type in executable: '/Users/myuser/.azure/bin/bicep'`

I'm pretty sure I've done this before without problems.

I tried to run:
`az bicep upgrade --target-platform osx-arm64`

But this also fails.

Then I tried:
`az bicep install --target-platform osx-arm64`

No error, but I still get:
`Debug: output = ERROR: [Errno 86] Bad CPU type in executable: '/Users/myuser/.azure/bin/bicep'`

Finally tried to reinstall the Azure CLI:
`brew uninstall azure-cli`
`brew install azure-cli`

But the problem persists. I'm not able to find a way to roll back to the previous version.

### Related command

-

### Errors

Here is the error:

```bash
az bicep upgrade --target-platform osx-arm64

The command failed with an unexpected error. Here is the traceback:
[Errno 86] Bad CPU type in executable: '/Users/myuser/.azure/bin/bicep'
Traceback (most recent call last):
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/knack/cli.py", line 233, in invoke
cmd_result = self.invocation.execute(args)
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
raise ex
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
results.append(self._run_job(expanded_arg, cmd_copy))
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
result = cmd_copy(params)
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
return self.handler(*args, **kwargs)
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
return op(**command_args)
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/custom.py", line 4292, in upgrade_bicep_cli
ensure_bicep_installation(cmd.cli_ctx, release_tag=latest_release_tag, target_platform=target_platform)
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 118, in ensure_bicep_installation
installed_version = _get_bicep_installed_version(installation_path)
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 267, in _get_bicep_installed_version
installed_version_output = _run_command(bicep_executable_path, ["--version"])
File "/opt/homebrew/Cellar/azure-cli/2.53.0/libexec/lib/python3.10/site-packages/azure/cli/command_modules/resource/_bicep.py", line 305, in _run_command
process = subprocess.run([rf"{bicep_installation_path}"] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/opt/homebrew/Cellar/python@3.10/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 503, in run
with Popen(*popenargs, **kwargs) as process:
File "/opt/homebrew/Cellar/python@3.10/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 971, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/opt/homebrew/Cellar/python@3.10/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1863, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 86] Bad CPU type in executable: '/Users/myuser/.azure/bin/bicep'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
```

### Issue script & Debug output

```bash
az bicep version

The command failed with an unexpected error. Here is the traceback:
[Errno 86] Bad CPU type in executable: '/Users/myuser/.azure/bin/bicep'
Traceback (most recent call last):
...
```

### Expected behavior

I expect that I can run `az bicep upgrade` and get the latest version. I expect that I don't need to add the platform (or that the warning that a new version is available has the correct upgrade command).

### Environment Summary

```bash
az --version
azure-cli 2.53.1

core 2.53.1
telemetry 1.1.0

Dependencies:
msal 1.24.0b2
azure-mgmt-resource 23.1.0b2

Python location '/opt/homebrew/Cellar/azure-cli/2.53.1/libexec/bin/python'
Extensions directory '/Users/myuser/.azure/cliextensions'

Python (Darwin) 3.10.13 (main, Aug 24 2023, 12:59:26) [Clang 15.0.0 (clang-1500.0.40.1)]

Your CLI is up-to-date.
```

### Additional context

_No response_

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.