{"record":{"id":"e98f347530d169ef","repo":"kubernetes/kops","slug":"waiting-for-load-balancer-s-after-deletion-w","errorCode":null,"errorMessage":"waiting for load-balancer %s after deletion: %w","messagePattern":"waiting for load-balancer (.+?) after deletion: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/scaleway/cloud.go","lineNumber":577,"sourceCode":"\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"waiting for load-balancer: %w\", err)\n\t}\n\terr = s.lbAPI.DeleteLB(&lb.ZonedAPIDeleteLBRequest{\n\t\tZone: s.zone,\n\t\tLBID: loadBalancer.ID,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deleting load-balancer %s: %w\", loadBalancer.ID, err)\n\t}\n\n\t// We wait for the load-balancer to be deleted, then we detach its IPs\n\t_, err = s.lbAPI.WaitForLb(&lb.ZonedAPIWaitForLBRequest{\n\t\tLBID: loadBalancer.ID,\n\t\tZone: s.zone,\n\t})\n\tif !is404Error(err) {\n\t\treturn fmt.Errorf(\"waiting for load-balancer %s after deletion: %w\", loadBalancer.ID, err)\n\t}\n\tfor _, ip := range ipsToRelease {\n\t\terr := s.lbAPI.ReleaseIP(&lb.ZonedAPIReleaseIPRequest{\n\t\t\tZone: s.zone,\n\t\t\tIPID: ip.ID,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"deleting load-balancer IP: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (s *scwCloudImplementation) DeleteServer(server *instance.Server) error {\n\tsrv, err := s.instanceAPI.GetServer(&instance.GetServerRequest{\n\t\tZone:     s.zone,\n\t\tServerID: server.ID,\n\t})","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/scaleway/cloud.go#L559-L595","documentation":"Wrap-around error from DeleteLoadBalancer's post-deletion WaitForLb: after DeleteLB, the code waits for the LB to disappear and only treats a 404 (gone) as success. If the wait returns any non-404 error, deletion is reported as failed with this wrapped error. Note that if err is nil here (LB still exists), the same message is returned since !is404Error(nil) is true.","triggerScenarios":"WaitForLb after DeleteLB returns a non-404 error: LB stuck in deleting state, API outage/rate limit during the wait, wrong zone, or the LB actually still existing because DeleteLB silently failed upstream.","commonSituations":"Scaleway LB taking long to terminate under load; API incident between DeleteLB and the wait; teardown retried concurrently by two kops runs; zone/config drift so the wrong LB is polled.","solutions":["Check the LB state in the console or `scw lb lb get <id> zone=<zone>` — if it's gone, re-running teardown will succeed (404 tolerated).","Retry after backoff; stuck deleting LBs usually terminate within minutes.","Ensure only one kops delete/teardown runs at a time to avoid racing waits.","If the LB is stuck for hours, contact Scaleway support or check status page, then re-run deletion."],"exampleFix":"// before\n_, err = s.lbAPI.WaitForLb(&lb.ZonedAPIWaitForLBRequest{LBID: loadBalancer.ID, Zone: s.zone})\nif !is404Error(err) {\n  return fmt.Errorf(\"waiting for load-balancer %s after deletion: %w\", loadBalancer.ID, err)\n}\n// after\n_, err = s.lbAPI.WaitForLb(&lb.ZonedAPIWaitForLBRequest{LBID: loadBalancer.ID, Zone: s.zone})\nif err != nil && !is404Error(err) {\n  return fmt.Errorf(\"waiting for load-balancer %s after deletion: %w\", loadBalancer.ID, err)\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := kopsDeleteCluster()\nif err != nil && strings.Contains(err.Error(), \"after deletion\") {\n  // LB may still be terminating; wait and verify, then re-run teardown\n  time.Sleep(2 * time.Minute)\n  return retry(err)\n}","preventionTips":["Treat LB teardown as eventually-consistent: poll console/CLI before assuming failure.","Avoid concurrent kops delete runs racing the same LB.","Allow generous timeouts during teardown; Scaleway LBs can lag in `deleting` state.","Check the status page for LB API incidents before large teardowns."],"tags":["scaleway","load-balancer","deletion","timeout"],"backgroundTag":"load-balancer-deletion-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"}