{"record":{"id":"7ce30fe33183ac3f","repo":"kubernetes/kops","slug":"getting-load-balancer-s-w","errorCode":null,"errorMessage":"getting load-balancer %s: %w","messagePattern":"getting load-balancer (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/scalewaytasks/loadbalancer.go","lineNumber":77,"sourceCode":"\treturn l.LBID\n}\n\n// GetWellKnownServices implements fi.HasAddress::GetWellKnownServices.\n// It indicates which services we support with this load balancer.\nfunc (l *LoadBalancer) GetWellKnownServices() []wellknownservices.WellKnownService {\n\treturn l.WellKnownServices\n}\n\nfunc (l *LoadBalancer) Find(context *fi.CloudupContext) (*LoadBalancer, error) {\n\tcloud := context.T.Cloud.(scaleway.ScwCloud)\n\tlbService := cloud.LBService()\n\n\tlbResponse, err := lbService.ListLBs(&lb.ZonedAPIListLBsRequest{\n\t\tZone: scw.Zone(cloud.Zone()),\n\t\tName: l.Name,\n\t}, scw.WithAllPages())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting load-balancer %s: %w\", fi.ValueOf(l.LBID), err)\n\t}\n\tif lbResponse.TotalCount != 1 {\n\t\treturn nil, nil\n\t}\n\tloadBalancer := lbResponse.LBs[0]\n\n\tlbIPs := []string(nil)\n\tfor _, IP := range loadBalancer.IP {\n\t\tlbIPs = append(lbIPs, IP.IPAddress)\n\t}\n\n\treturn &LoadBalancer{\n\t\tName:              new(loadBalancer.Name),\n\t\tLBID:              new(loadBalancer.ID),\n\t\tZone:              new(string(loadBalancer.Zone)),\n\t\tLBAddresses:       lbIPs,\n\t\tTags:              loadBalancer.Tags,\n\t\tLifecycle:         l.Lifecycle,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/scalewaytasks/loadbalancer.go#L59-L95","documentation":"kOps wraps failures from `lbService.ListLBs` when the LoadBalancer task's Find locates the cluster's Scaleway load-balancer by name (paging through all pages). Note the message prints l.LBID, though the search is by Name. The error comes from the Scaleway LB Zoned API; 'not found' alone does NOT throw (TotalCount != 1 returns nil, nil). Thrown in Find of loadbalancer.go.","triggerScenarios":"Find calls ListLBs with Zone=scw.Zone(cloud.Zone()) and Name=l.Name, using WithAllPages; the listing call fails — invalid zone, auth failure, API outage, or rate limiting during pagination.","commonSituations":"Cloud zone configuration doesn't match where the LB is provisioned; expired/insufficient credentials; Scaleway API incident; LB deleted out-of-band (returns nil instead, but related calls may error).","solutions":["Rerun `kops update cluster` — often transient","Verify the LB exists in the Scaleway console in the zone configured for the cloud","Check Scaleway credentials and project permissions for the LB API","Inspect the wrapped scw error (404/403/429/5xx) for the precise cause","If the zone is wrong, fix the cluster's zone configuration and re-run update"],"exampleFix":"// before: message uses LBID while searching by name\nreturn nil, fmt.Errorf(\"getting load-balancer %s: %w\", fi.ValueOf(l.LBID), err)\n// after: include both name and zone for diagnosability\nreturn nil, fmt.Errorf(\"getting load-balancer %q in zone %s: %w\", l.Name, scw.Zone(cloud.Zone()), err)","handlingStrategy":"type-guard","validationCode":"// check zone and credentials before listing LBs\nif cloud.Zone() == \"\" { return errors.New(\"cloud zone not set; cannot locate load-balancer\") }\nif l.Name == \"\" && fi.ValueOf(l.LBID) == \"\" { return errors.New(\"neither LB name nor LBID configured\") }","typeGuard":"func lbAPIError(err error) (status int, ok bool) {\n    var serr *scw.ResponseError\n    if errors.As(err, &serr) { return serr.Status, true }\n    return 0, false\n}","tryCatchPattern":"if err != nil {\n    if s, ok := lbAPIError(err); ok && s == 403 {\n        return nil, fmt.Errorf(\"check Scaleway credentials for LB API: %w\", err)\n    }\n    return nil, fmt.Errorf(\"getting load-balancer %q in zone %s: %w\", l.Name, cloud.Zone(), err)\n}","preventionTips":["Keep cloud zone configuration in sync with where kOps provisions the LB","Treat TotalCount != 1 as not-found, not an error","Rotate Scaleway service-account keys before expiry","Log name and zone (not just ID) in wrapped errors for faster diagnosis"],"tags":["scaleway","load-balancer","api-error","find"],"backgroundTag":"scaleway-lb-list-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"}