kubernetes/kops · error
creating resource group client: %w
Error message
creating resource group client: %w
What it means
Wraps failure of resources.NewResourceGroupsClient, the constructor for the ARM resource groups client. As with the other Azure client constructors, failure means the SDK could not build a client pipeline for the given subscription ID and credential/options.
Source
Thrown at upup/pkg/fi/cloudup/azure/resourcegroup.go:72
}
return l, nil
}
func (c *resourceGroupsClientImpl) Delete(ctx context.Context, name string) error {
future, err := c.c.BeginDelete(ctx, name, nil)
if err != nil {
return fmt.Errorf("deleting resource group: %w", err)
}
if _, err = future.PollUntilDone(ctx, nil); err != nil {
return fmt.Errorf("waiting for resource group deletion completion: %w", err)
}
return nil
}
func newResourceGroupsClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*resourceGroupsClientImpl, error) {
c, err := resources.NewResourceGroupsClient(subscriptionID, cred, nil)
if err != nil {
return nil, fmt.Errorf("creating resource group client: %w", err)
}
return &resourceGroupsClientImpl{
c: c,
}, nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Pass a valid, non-empty subscription ID (check AZURE_SUBSCRIPTION_ID / cluster spec)
- Confirm cred (DefaultAzureCredential) is non-nil and was built successfully
- After upgrading azure-sdk-for-go modules, update the constructor call to the new API
- Set AZURE_TENANT_ID/CLIENT_ID/CLIENT_SECRET explicitly if environment auth is expected
Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(subscriptionID) == "" {
return errors.New("azure: resource groups client requires a non-empty subscription ID")
}
if cred == nil {
return errors.New("azure: credential must be constructed before creating clients")
} Type guard
func isValidSubscriptionID(id string) bool {
re := regexp.MustCompile(`^[0-9a-fA-F-]{36}$`)
return re.MatchString(id)
} Try / catch
rgc, err := newResourceGroupsClientImpl(subID, cred)
if err != nil {
return nil, fmt.Errorf("cannot build azure cloud (check AZURE_SUBSCRIPTION_ID and credentials): %w", err)
} Prevention
- Validate subscription ID format before cloud construction
- Build and verify credentials first, then construct clients
- Keep azure-sdk-for-go modules in sync across all azure client files
- Add a preflight 'az account show' check to CI teardown jobs
When it happens
Trigger: newResourceGroupsClientImpl(subscriptionID, cred) called (from newAzureCloud) with an empty subscription ID or invalid credential/options.
Common situations: Missing or empty subscription ID in kOps Azure cloud configuration; constructing the cloud before credentials are resolved; SDK version upgrade changing the constructor signature/behavior.
Related errors
- creating public ip addresses client: %w
- creating VMSSs client: %w
- unexpected subnet type: for InstanceGroup %q; type was %s
- malformed format of image urn: %s
- empty subscription ID
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/14dcaa7d2a7f90d3.
Report an issue: GitHub.