fix(cli): improve error message when deploying Radius types with wrong API version#11557
Open
officialasishkumar wants to merge 5 commits intoradius-project:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the rad deploy UX when a Radius resource type is used with an unsupported/incorrect API version and is consequently misrouted through Azure, producing a misleading “configure an Azure provider” error.
Changes:
- Wrap misleading Azure-related deployment errors with actionable context when the compiled template contains only Radius resource types.
- Add Bicep template helpers to extract and classify resource types (Radius vs non-Radius).
- Add unit tests covering resource type extraction/classification and the deployment error wrapping behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/cli/cmd/deploy/deploy.go | Wraps Azure-related deployment errors with additional context when the template contains only Radius types. |
| pkg/cli/cmd/deploy/deploy_test.go | Adds unit tests validating when deployment errors are wrapped vs returned unchanged. |
| pkg/cli/bicep/resources.go | Adds helpers to extract resource types and detect whether a template contains only Radius resource types. |
| pkg/cli/bicep/resources_test.go | Adds unit tests for resource type extraction and Radius-namespace classification. |
willdavsmith
requested changes
Apr 6, 2026
Contributor
willdavsmith
left a comment
There was a problem hiding this comment.
thanks for the contribution! added a couple of comments
…g API version When a Bicep template uses a Radius resource type with an unsupported API version (e.g., Radius.Core/applications@2023-10-01-preview), the Bicep compiler cannot resolve the type and treats it as a passthrough ARM resource. The deployment engine then routes it through Azure, producing a misleading error: "Azure deployment failed, please ensure you have configured an Azure provider." This change detects the mismatch between the error (Azure-related) and the template contents (Radius-only resource types) and wraps the error with a clear, actionable message that suggests checking the API version for each resource type. Changes: - Add ExtractResourceTypes, IsRadiusResourceType, and HasOnlyRadiusResourceTypes helpers to pkg/cli/bicep/resources.go - Add addDeploymentErrorContext to the deploy command to detect and contextualize misleading Azure errors for Radius-only templates - Add comprehensive unit tests for all new functions Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
30aa590 to
c309c98
Compare
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
c309c98 to
5ff6b46
Compare
…error-for-wrong-api-version
Match on the exact Deployment Engine error pattern instead of hardcoding "azure" in string matching. Change resource type namespace list to use Applications.* and Radius.* patterns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a Bicep template uses a Radius resource type with an unsupported API version (e.g.,
Radius.Core/applications@2023-10-01-preview), the Bicep compiler cannot resolve the type and treats it as a passthrough ARM resource. The deployment engine then routes it through Azure, producing a misleading error:This is confusing because the user intended to deploy a Radius resource, not an Azure resource. The actual problem is that the API version is wrong for the given resource type namespace.
This change detects the mismatch between the error (Azure-related) and the template contents (Radius-only resource types) and wraps the error with a clear, actionable message that suggests checking the API version for each resource type. After this change, users will see:
Changes
pkg/cli/bicep/resources.go: AddExtractResourceTypes,IsRadiusResourceType, andHasOnlyRadiusResourceTypeshelpers for template resource type analysispkg/cli/cmd/deploy/deploy.go: AddaddDeploymentErrorContextto detect and contextualize misleading Azure errors for Radius-only templatespkg/cli/bicep/resources_test.go: Add comprehensive unit tests for resource type extraction and classificationpkg/cli/cmd/deploy/deploy_test.go: Add unit tests for the error context wrapping logicType of change
Fixes: #11462
Contributor checklist
Please verify that the PR meets the following requirements, where applicable: