{"record":{"id":"a00f5090faf0b0d9","repo":"kubernetes/kops","slug":"wait-time-exceeded-during-resources-deletion","errorCode":null,"errorMessage":"wait time exceeded during resources deletion","messagePattern":"wait time exceeded during resources deletion","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/ops/delete.go","lineNumber":61,"sourceCode":"\t\t}\n\n\t\tdepMap[k] = append(depMap[k], t.Blocked...)\n\n\t\tif t.Done {\n\t\t\tdone[k] = t\n\t\t}\n\t}\n\n\tklog.V(2).Info(\"Dependencies\")\n\tfor k, v := range depMap {\n\t\tklog.V(2).Infof(\"\\t%s\\t%v\", k, v)\n\t}\n\n\ttimeout := time.Now().Add(wait)\n\titerationsWithNoProgress := 0\n\tfor {\n\t\tif wait > 0 && time.Now().After(timeout) {\n\t\t\treturn fmt.Errorf(\"wait time exceeded during resources deletion\")\n\t\t}\n\n\t\tfailed := make(map[string]*resources.Resource)\n\n\t\tfor {\n\t\t\tphase := make(map[string]*resources.Resource)\n\n\t\t\tfor k, r := range resourceMap {\n\t\t\t\tif _, d := done[k]; d {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif _, d := failed[k]; d {\n\t\t\t\t\t// Only attempt each resource once per pass\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tready := true","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/ops/delete.go#L43-L79","documentation":"DeleteResources polls in a loop until all resources are deleted. If a caller passes a positive `wait` duration and the elapsed time exceeds it before every resource reaches Done state, this error is returned. It means deletion is slower than the allowed window — resources may still exist and deletion may still be in progress in the cloud.","triggerScenarios":"Calling DeleteResources (pkg/resources/ops/delete.go:61) with a finite wait (e.g. `kops delete cluster` default timeout) while cloud resources (LBs, volumes, instances) take longer to reach a deleted state, or some deletes repeatedly fail so the loop never converges before the timeout.","commonSituations":"Large clusters with many ELBs/EBS volumes that take minutes to drain; cloud provider API rate limiting slowing deletes; a stuck resource (e.g. volume attached, LB with targets) blocking dependency ordering; too-short timeout flag passed by the user.","solutions":["Increase the deletion timeout (e.g. `kops delete cluster --timeout` or larger `wait` duration)","Re-run the delete command — it resumes deleting remaining resources","Investigate resources that repeatedly fail to delete (permissions, dependencies, finalizers in the cloud)","Check cloud provider console for resources stuck in deleting state and clean them up manually"],"exampleFix":"// before\nerr := ops.DeleteResources(cloud, resources, 10, 10*time.Second, 5*time.Minute)\n// after — allow more time for large clusters\nerr := ops.DeleteResources(cloud, resources, 10, 10*time.Second, 30*time.Minute)","handlingStrategy":"retry","validationCode":"// Size the timeout from cluster scale before deleting\nwait := 30 * time.Minute\nif len(resourceMap) > 200 {\n    wait = time.Duration(len(resourceMap)) * time.Minute\n}","typeGuard":null,"tryCatchPattern":"if err := ops.DeleteResources(cloud, resourceMap, 10, 10*time.Second, wait); err != nil {\n    if strings.Contains(err.Error(), \"wait time exceeded\") {\n        klog.Warning(\"deletion timed out; resources may remain — re-running delete resumes\")\n        return ops.DeleteResources(cloud, resourceMap, 10, 10*time.Second, wait) // idempotent resume\n    }\n    return err\n}","preventionTips":["Give large clusters generous timeouts","Don't abort automation on this error — rerun, deletion is resumable","Monitor cloud console for slow-deleting resources (LBs, volumes)","Avoid API-throttling during bulk deletes"],"tags":["timeout","delete","retry","cloud"],"backgroundTag":"deletion-timeout-exceeded","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"}