{"record":{"id":"676894c9b18aebc4","repo":"kubernetes/kops","slug":"waiting-for-resource-group-deletion-completion-w","errorCode":null,"errorMessage":"waiting for resource group deletion completion: %w","messagePattern":"waiting for resource group deletion completion: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azure/resourcegroup.go","lineNumber":64,"sourceCode":"\tvar l []*resources.ResourceGroup\n\tpager := c.c.NewListPager(nil)\n\tfor pager.More() {\n\t\tresp, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"listing resource groups: %w\", err)\n\t\t}\n\t\tl = append(l, resp.Value...)\n\t}\n\treturn l, nil\n}\n\nfunc (c *resourceGroupsClientImpl) Delete(ctx context.Context, name string) error {\n\tfuture, err := c.c.BeginDelete(ctx, name, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deleting resource group: %w\", err)\n\t}\n\tif _, err = future.PollUntilDone(ctx, nil); err != nil {\n\t\treturn fmt.Errorf(\"waiting for resource group deletion completion: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc newResourceGroupsClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*resourceGroupsClientImpl, error) {\n\tc, err := resources.NewResourceGroupsClient(subscriptionID, cred, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating resource group client: %w\", err)\n\t}\n\treturn &resourceGroupsClientImpl{\n\t\tc: c,\n\t}, nil\n}\n","sourceCodeStart":46,"sourceCodeEnd":78,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azure/resourcegroup.go#L46-L78","documentation":"Wraps the failure of future.PollUntilDone while waiting for the asynchronous resource-group deletion LRO to finish. Resource group deletion can take many minutes with many contained resources; the poll fails if the server-side operation errors, the context is cancelled, or retries are exhausted.","triggerScenarios":"BeginDelete succeeded, then PollUntilDone(ctx, nil) returns: the LRO reports a failure (e.g. a contained resource failed to delete), ctx deadline exceeded / cancelled, or repeated transient ARM errors exhaust the poller retry policy.","commonSituations":"kOps teardown killed by context timeout before all contained resources finished deleting; orphaned resources (disks, NICs, public IPs) causing the group deletion to stall/fail; long-lived groups where default poll interval misses completion within ctx budget.","solutions":["Inspect the wrapped error for the LRO failure detail; check the group's Activity Log in the Azure portal","Retry Delete — it is safe to re-issue; the group may still be deleting","Ensure all contained resources are deletable (no locks, no leftover disks/NICs) then re-run","Use a longer-lived context for resource group deletion, which can take 15+ minutes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute) // RG deletion can exceed 15 min\ndefer cancel()","typeGuard":"func isContextErr(err error) bool {\n  return errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded)\n}","tryCatchPattern":"err := rgClient.Delete(ctx, name)\nif err != nil {\n  if isContextErr(err) || true { /* LRO continues server-side */ }\n  // safe to re-call Delete; it resumes/waits again\n  return fmt.Errorf(\"rg %s deletion incomplete: %w\", name, err)\n}","preventionTips":["Budget generous timeouts (20-30+ min) for resource-group deletion","Re-invoke Delete on interruption; the operation is idempotent","Clean orphaned contained resources (disks, NICs, IPs) that stall group deletion","Monitor the group in the Azure portal Activity Log during teardown"],"tags":["azure","long-running-operation","resource-groups","polling"],"backgroundTag":"azure-lro-poll-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}