When I try to run az bicep version
I’m getting this
error
The command failed with an unexpected error. Here is the traceback:
[WinError 193] %1 is not a valid Win32 application
Traceback (most recent call last):
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesknack/cli.py", line 233, in invoke
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/core/commands/__init__.py", line 664, in execute
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/core/commands/__init__.py", line 729, in _run_jobs_serially
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/core/commands/__init__.py", line 698, in _run_job
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/core/commands/__init__.py", line 334, in __call__
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/core/commands/command_operation.py", line 121, in handler
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/command_modules/resource/custom.py", line 4601, in show_bicep_cli_version
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/command_modules/resource/_bicep.py", line 94, in run_bicep_command
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/command_modules/resource/_bicep.py", line 267, in _get_bicep_installed_version
File "D:a_work1sbuild_scriptswindowsartifactscliLibsite-packagesazure/cli/command_modules/resource/_bicep.py", line 305, in _run_command
File "subprocess.py", line 548, in run
File "subprocess.py", line 1026, in __init__
File "subprocess.py", line 1538, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application
And the same error I have running all az bicep ***
commands.
I tried to reinstall azure cli. Did not help.
I deleted py related paths from PATH env variables. That was a suggestion from some github issue page.
2
Answers
The most likely cause of your error is that the bicep executable installed by Azure CLI is corrupted. See Issue #2364 on their repository.
As described in this comment you can clean up the
%USERPROFILE.azurebin
directory and runaz bicep install
to get it working.Here are some steps you can take to troubleshoot and resolve this issue:
Check the Bicep installation: Ensure that Bicep is correctly installed on your system and that the executable is located in a directory listed in your system’s PATH environment variable.
Verify executable: Confirm that the Bicep executable is indeed an executable file and not corrupted. You can do this by checking its file properties or attempting to run it directly from the command line.
Check PATH environment variable: Double-check that the directory containing the Bicep executable is listed in your system’s PATH environment variable. Sometimes, changes to the PATH variable may require a system restart to take effect.
Reinstall Bicep: If you suspect that the Bicep executable is corrupt, try reinstalling it from scratch. Download the latest version from the official source and install it according to the documentation.
Check for antivirus interference: It’s possible that your antivirus software is interfering with the execution of the Bicep executable. Temporarily disable any antivirus software and see if the issue persists.
Run from a different environment: Try running the az bicep version command from a different command prompt or shell environment to see if the issue is specific to one environment.
Check for system updates: Ensure that your Windows system is up-to-date with the latest patches and updates. Sometimes, system updates can resolve compatibility issues with certain software.
Look for specific issue reports: Search online for any reported issues related to the specific error message you’re encountering. Sometimes, other users may have encountered similar problems and found solutions or workarounds.