{"record":{"id":"4a08e184cd191bbd","repo":"kubernetes/kops","slug":"waiting-for-public-ip-address-deletion-completion","errorCode":null,"errorMessage":"waiting for public ip address deletion completion: %w","messagePattern":"waiting for public ip address deletion completion: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azure/publicipaddress.go","lineNumber":81,"sourceCode":"\t\tif err != nil {\n\t\t\tvar respErr *azcore.ResponseError\n\t\t\tif errors.As(err, &respErr) && respErr.ErrorCode == \"ResourceGroupNotFound\" {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"listing public ip addresses: %w\", err)\n\t\t}\n\t\tl = append(l, resp.Value...)\n\t}\n\treturn l, nil\n}\n\nfunc (c *publicIPAddressesClientImpl) Delete(ctx context.Context, resourceGroupName, publicIPAddressName string) error {\n\tfuture, err := c.c.BeginDelete(ctx, resourceGroupName, publicIPAddressName, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deleting public ip address: %w\", err)\n\t}\n\tif _, err := future.PollUntilDone(ctx, nil); err != nil {\n\t\treturn fmt.Errorf(\"waiting for public ip address deletion completion: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc newPublicIPAddressesClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*publicIPAddressesClientImpl, error) {\n\tc, err := network.NewPublicIPAddressesClient(subscriptionID, cred, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating public ip addresses client: %w\", err)\n\t}\n\treturn &publicIPAddressesClientImpl{\n\t\tc: c,\n\t}, nil\n}\n","sourceCodeStart":63,"sourceCodeEnd":95,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azure/publicipaddress.go#L63-L95","documentation":"Wraps the error from future.PollUntilDone after BeginDelete succeeded, i.e. the asynchronous deletion of the public IP failed or was interrupted while polling. Causes include the poller being cancelled (context cancellation), the long-running operation failing server-side, or timeout of the default retry policy.","triggerScenarios":"BeginDelete accepted the LRO, then PollUntilDone(ctx, nil) observes the operation fail (ARM operation-level error, e.g. InUseCannotBeDeleted) or the ctx is cancelled/times out before the deletion completes.","commonSituations":"kOps context cancelled by Ctrl-C or parent timeout while tearing down a cluster; Azure reports the IP still bound to a NIC/LB (InUseCannotBeDeleted); transient ARM 5xx during the poll.","solutions":["Check the wrapped error / poller failure details for the ARM operation error code","If InUseCannotBeDeleted, dissociate the IP from its NIC or load balancer and retry Delete","Re-run deletion — re-invoking Delete on an already-deleting/deleted resource is safe (idempotent)","Pass a context with sufficient timeout to cover Azure LRO completion"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)\ndefer cancel() // give the LRO enough time before starting Delete","typeGuard":"func isInUseError(err error) bool {\n  var re *azcore.ResponseError\n  return errors.As(err, &re) && strings.Contains(re.ErrorCode, \"InUse\")\n}","tryCatchPattern":"err := client.Delete(ctx, rg, name)\nif err != nil {\n  if isInUseError(err) { /* dissociate then retry Delete */ }\n  if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { /* resubmit; deletion continues server-side */ }\n}","preventionTips":["Use a long context timeout for LRO polling","Retry Delete on transient failures — it is idempotent","Check for InUseCannotBeDeleted and dissociate first","Avoid Ctrl-C'ing mid-teardown; let the poller finish"],"tags":["azure","long-running-operation","delete","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-12T07:17:12.445Z"}