{"record":{"id":"32abcb272b467772","repo":"kubernetes/kops","slug":"creating-updating-disk-w","errorCode":null,"errorMessage":"creating/updating disk: %w","messagePattern":"creating/updating disk: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azure/disk.go","lineNumber":45,"sourceCode":")\n\n// DisksClient is a client for managing disks.\ntype DisksClient interface {\n\tCreateOrUpdate(ctx context.Context, resourceGroupName, diskName string, parameters compute.Disk) (*compute.Disk, error)\n\tList(ctx context.Context, resourceGroupName string) ([]*compute.Disk, error)\n\tDelete(ctx context.Context, resourceGroupName, diskname string) error\n}\n\ntype disksClientImpl struct {\n\tc *compute.DisksClient\n}\n\nvar _ DisksClient = (*disksClientImpl)(nil)\n\nfunc (c *disksClientImpl) CreateOrUpdate(ctx context.Context, resourceGroupName, diskName string, parameters compute.Disk) (*compute.Disk, error) {\n\tfuture, err := c.c.BeginCreateOrUpdate(ctx, resourceGroupName, diskName, parameters, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating/updating disk: %w\", err)\n\t}\n\tresp, err := future.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"waiting for disk create/update completion: %w\", err)\n\t}\n\treturn &resp.Disk, err\n}\n\nfunc (c *disksClientImpl) List(ctx context.Context, resourceGroupName string) ([]*compute.Disk, error) {\n\tif resourceGroupName == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tvar l []*compute.Disk\n\tpager := c.c.NewListByResourceGroupPager(resourceGroupName, nil)\n\tfor pager.More() {\n\t\tresp, err := pager.NextPage(ctx)\n\t\tif err != nil {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azure/disk.go#L27-L63","documentation":"The DisksClient.CreateOrUpdate wrapper calls armcompute's BeginCreateOrUpdate to create or update a managed disk. Any error returned synchronously by the Azure Resource Manager API (before a polling future can be created) is wrapped as \"creating/updating disk: %w\". Typical wrapped causes are invalid request payload, authentication/authorization failures, or the resource group/subscription not resolving.","triggerScenarios":"Calling DisksClient.CreateOrUpdate when the ARM API rejects the initial request: invalid compute.Disk parameters (bad SKU, invalid diskSizeGB), missing/insufficient RBAC (Microsoft.Compute/disks/write denied), nonexistent resource group, wrong subscription ID, expired or missing Azure credentials, or throttling (429) at request submission time.","commonSituations":"Deploying a cluster with a service principal whose scope does not cover the node resource group; typos in resourceGroupName; quota exceeded in the region; azidentity credentials not available (no managed identity / az login); SDK version mismatch producing an invalid parameters struct.","solutions":["Unwrap the error and inspect the *azcore.ResponseError StatusCode/ErrorCode to identify the actual ARM failure (401/403 auth, 404 resource group, 409 conflict/quota, 429 throttling).","Verify the Azure identity has Microsoft.Compute/disks/write permission on the target resource group.","Confirm resourceGroupName and subscriptionID match the cluster (cluster resource group vs node resource group).","Validate the compute.Disk parameters (Location, SKU name, DiskSizeGB, Zone) against the target region's supported values.","If throttled (429), retry with backoff; if auth failed, refresh credentials (az login / managed identity)."],"exampleFix":"var respErr *azcore.ResponseError\nif errors.As(err, &respErr) {\n    klog.Infof(\"disk create failed: %s %d %s\", respErr.ErrorCode, respErr.StatusCode, respErr.Error())\n    if respErr.StatusCode == 429 {\n        // retry after backoff\n    }\n}","handlingStrategy":"try-catch","validationCode":"var respErr *azcore.ResponseError\nif errors.As(err, &respErr) && respErr.StatusCode == 404 {\n    return nil, fmt.Errorf(\"resource group %q not found: check subscription/rg names\", resourceGroupName)\n}","typeGuard":"func isAzureResponseError(err error) (*azcore.ResponseError, bool) {\n    var re *azcore.ResponseError\n    ok := errors.As(err, &re)\n    return re, ok\n}","tryCatchPattern":"if err != nil {\n    var respErr *azcore.ResponseError\n    switch {\n    case errors.As(err, &respErr) && respErr.StatusCode == 429:\n        // backoff and retry\n    case errors.As(err, &respErr) && (respErr.StatusCode == 401 || respErr.StatusCode == 403):\n        return fmt.Errorf(\"insufficient Azure permissions or bad credentials: %w\", err)\n    default:\n        return fmt.Errorf(\"disk create/update failed: %w\", err)\n    }\n}","preventionTips":["Grant the cluster identity Microsoft.Compute/disks/write (Contributor on the node resource group).","Validate compute.Disk parameters (SKU, size, zone, region support) before calling CreateOrUpdate.","Use retry policies with backoff for 429s; check Azure quota in the target region ahead of time."],"tags":["azure","disk","arm-api","cloud-provider"],"backgroundTag":"azure-request-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}