-
Notifications
You must be signed in to change notification settings - Fork 3.4k
az vm create: SkuNotAvailable throws RuntimeError instead of clear error message #33159
Copy link
Copy link
Open
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotError MessagesPossible-SolutionSimilar-Issueact-observability-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Metadata
Metadata
Assignees
Labels
Auto-AssignAuto assign by botAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamThe command of the issue is owned by Azure CLI teamComputeaz vm/vmss/image/disk/snapshotaz vm/vmss/image/disk/snapshotError MessagesPossible-SolutionSimilar-Issueact-observability-squadbugThis issue requires a change to an existing behavior in the product in order to be resolved.This issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.Issues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as thatThe issue doesn't require a change to the product in order to be resolved. Most issues start as that
Bug Report
Description
When running
az vm createwith a VM size that is unavailable due to capacity restrictions, the CLI throws a confusingRuntimeError: The content for this response was already consumedinstead of showing a clear, actionable error message.The actual root cause (
SkuNotAvailable) is buried deep in the traceback and not surfaced cleanly to the user.Command Used
Expected Behavior
A clean, user-friendly error message like:
Actual Behavior
The real cause (
SkuNotAvailable: Standard_B2s not available in eastus/eastus2) is only visible deep in the traceback.Impact
Environment
eastus,eastus2Standard_B2sSuggested Fix
In
arm.py, catchSkuNotAvailableinner exceptions and surface them as a cleanCLIErrorwith a helpful suggestion to runaz vm list-skus.References
4abe575f-76d8-4ae5-9ba1-a5ca05c7d169SkuNotAvailableRelated command
az vm create
Errors
(InvalidTemplateDeployment) The template deployment is not valid according to the validation procedure.
Code: InvalidTemplateDeployment
Inner Error:
Code: SkuNotAvailable
Message: The requested VM size for resource 'Following SKUs have failed for Capacity
Restrictions: Standard_B2s' is currently not available in location 'eastus'.
Please try another size or deploy to a different location or different zone.
RuntimeError: The content for this response was already consumed
Issue script & Debug output
az vm create
-g rg-openclaw -n vm-openclaw
--image Ubuntu2204
--size Standard_B2s
--admin-username azureuser
--generate-ssh-keys
--vnet-name vnet-openclaw
--subnet snet-openclaw-vm
--debug
Expected behavior
ERROR: The VM size 'Standard_B2s' is not available in location 'eastus'
due to capacity restrictions. Try a different size or region.
Tip: Run
az vm list-skus --location eastus --size Standard_B --output tableto find available sizes.
Environment Summary
az --version
Additional context
Tested in both eastus and eastus2 — Standard_B2s unavailable in both
Error occurs in arm.py inside handle_template_based_exception where ex.inner_exception is None, causing an AttributeError that masks the real SkuNotAvailable error
Suggested fix: in arm.py, explicitly catch SkuNotAvailable from inner exceptions and raise a clean CLIError with a helpful suggestion
Reference: https://aka.ms/azureskunotavailable