{"record":{"id":"5deac9a32f46b505","repo":"kubernetes/kops","slug":"listing-back-ends-for-load-balancer-s-w","errorCode":null,"errorMessage":"listing back-ends for load-balancer %s: %w","messagePattern":"listing back-ends for load-balancer (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/scalewaytasks/lb_backend.go","lineNumber":83,"sourceCode":"func (l *LBBackend) CompareWithID() *string {\n\treturn l.ID\n}\n\nfunc (l *LBBackend) Find(context *fi.CloudupContext) (*LBBackend, error) {\n\tcloud := context.T.Cloud.(scaleway.ScwCloud)\n\tlbService := cloud.LBService()\n\n\tif l.LoadBalancer.LBID == nil {\n\t\treturn nil, nil\n\t}\n\n\tbackendResponse, err := lbService.ListBackends(&lb.ZonedAPIListBackendsRequest{\n\t\tZone: scw.Zone(cloud.Zone()),\n\t\tLBID: fi.ValueOf(l.LoadBalancer.LBID),\n\t\tName: l.Name,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"listing back-ends for load-balancer %s: %w\", fi.ValueOf(l.LoadBalancer.LBID), err)\n\t}\n\tif backendResponse.TotalCount != 1 {\n\t\treturn nil, nil\n\t}\n\tbackend := backendResponse.Backends[0]\n\n\treturn &LBBackend{\n\t\tName:                 new(backend.Name),\n\t\tLifecycle:            l.Lifecycle,\n\t\tID:                   new(backend.ID),\n\t\tZone:                 new(string(backend.LB.Zone)),\n\t\tForwardProtocol:      new(string(backend.ForwardProtocol)),\n\t\tForwardPort:          new(backend.ForwardPort),\n\t\tForwardPortAlgorithm: new(string(backend.ForwardPortAlgorithm)),\n\t\tStickySessions:       new(string(backend.StickySessions)),\n\t\tProxyProtocol:        new(string(backend.ProxyProtocol)),\n\t\tLoadBalancer: &LoadBalancer{\n\t\t\tName: new(backend.LB.Name),","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/scalewaytasks/lb_backend.go#L65-L101","documentation":"During LBBackend.Find, kOps lists back-ends of the Scaleway Load Balancer filtered by name to locate the existing backend matching this task. This error wraps a failure of lb.ZonedAPI.ListBackends. It is thrown whenever the LB API listing call itself fails (auth, zone/LBID invalid, network) — note a zero or multiple matches does NOT error (returns nil), only the API call failing does.","triggerScenarios":"lbService.ListBackends(&lb.ZonedAPIListBackendsRequest{Zone, LBID, Name}) returns an error: invalid or deleted LBID (lb deleted out-of-band), wrong zone vs. the LB's actual zone, expired/insufficient SCW credentials, 403 permission-denied on the LB resource, or network/API outage.","commonSituations":"Load balancer was deleted manually in the Scaleway console while cluster state still references it; cluster.spec region/zone changed so the LB ID no longer matches; IAM policy change removed lb read permission from the kOps service account; SCW API outage during `kops update cluster`.","solutions":["Verify the LB exists and matches: `scw lb lb list` and compare the LBID stored in cluster state.","Check the zone used (cloud.Zone()) matches the load-balancer's zone (`scw lb lb get <id>`).","Re-authenticate: verify SCW_ACCESS_KEY/SCW_SECRET_KEY and that the key has LB read permissions (Container/LB Manager policy).","If the LB was deleted out-of-band, run `kops update cluster` to recreate it (Find returning the listing error first must pass once credentials/LB are fixed).","Retry on transient 5xx; check Scaleway status page."],"exampleFix":"// ensure LBID nil-check and zone correctness before listing\nif l.LoadBalancer.LBID == nil {\n    return nil, nil\n}\nbackendResponse, err := lbService.ListBackends(&lb.ZonedAPIListBackendsRequest{\n    Zone: scw.Zone(cloud.Zone()), // must equal the LB's zone, not the cluster default\n    LBID: fi.ValueOf(l.LoadBalancer.LBID),\n    Name: l.Name,\n})","handlingStrategy":"try-catch","validationCode":"// pre-flight: confirm the LB exists and is reachable in the expected zone\nlbs, err := lbService.ListLBs(&lb.ZonedAPIListLBsRequest{Zone: scw.Zone(cloud.Zone()), Name: &lbName})\nif err != nil || len(lbs.LBs) == 0 {\n    return fmt.Errorf(\"load-balancer %s not found in zone %s: %w\", lbName, zone, err)\n}","typeGuard":"func isScwNotFoundOrDenied(err error) (notFound, denied bool) {\n    var respErr *scw.ResponseError\n    if !errors.As(err, &respErr) { return false, false }\n    return respErr.StatusCode == http.StatusNotFound, respErr.StatusCode == http.StatusForbidden\n}","tryCatchPattern":"backendResponse, err := lbService.ListBackends(req)\nif err != nil {\n    var respErr *scw.ResponseError\n    if errors.As(err, &respErr) && respErr.StatusCode == 404 {\n        return nil, nil // LB gone; let RenderScw recreate it\n    }\n    return nil, fmt.Errorf(\"listing back-ends for load-balancer %s: %w\", fi.ValueOf(l.LoadBalancer.LBID), err)\n}","preventionTips":["Never delete Scaleway LBs out-of-band while kOps manages them","Ensure the SCW API key has LB read permissions in IAM","Keep cluster spec zone consistent with the LB's zone","Run `scw lb lb list` before applies after any manual console changes"],"tags":["scaleway","load-balancer","api","auth"],"backgroundTag":"api-list-request-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"}