{"record":{"id":"aa7eb18407c5e02c","repo":"kubernetes/kops","slug":"updating-back-end-for-load-balancer-s-w","errorCode":null,"errorMessage":"updating back-end for load-balancer %s: %w","messagePattern":"updating back-end for load-balancer (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/scalewaytasks/lb_backend.go","lineNumber":154,"sourceCode":"\tcontrolPlanesIPs, err := getControlPlanesIPs(t.Cloud, expected.LoadBalancer, zone)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif actual != nil {\n\n\t\t_, err := lbService.UpdateBackend(&lb.ZonedAPIUpdateBackendRequest{\n\t\t\tZone:                 zone,\n\t\t\tBackendID:            fi.ValueOf(actual.ID),\n\t\t\tName:                 fi.ValueOf(actual.Name),\n\t\t\tForwardProtocol:      lb.Protocol(fi.ValueOf(expected.ForwardProtocol)),\n\t\t\tForwardPort:          fi.ValueOf(expected.ForwardPort),\n\t\t\tForwardPortAlgorithm: lb.ForwardPortAlgorithm(fi.ValueOf(expected.ForwardPortAlgorithm)),\n\t\t\tStickySessions:       lb.StickySessionsType(fi.ValueOf(expected.StickySessions)),\n\t\t\tProxyProtocol:        lb.ProxyProtocol(fi.ValueOf(expected.ProxyProtocol)),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"updating back-end for load-balancer %s: %w\", fi.ValueOf(actual.LoadBalancer.Name), err)\n\t\t}\n\n\t\t_, err = lbService.SetBackendServers(&lb.ZonedAPISetBackendServersRequest{\n\t\t\tZone:      zone,\n\t\t\tBackendID: fi.ValueOf(actual.ID),\n\t\t\tServerIP:  controlPlanesIPs,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"updating back-end server IPs for load-balancer %s: %w\", fi.ValueOf(actual.LoadBalancer.Name), err)\n\t\t}\n\n\t} else {\n\n\t\tbackendCreated, err := lbService.CreateBackend(&lb.ZonedAPICreateBackendRequest{\n\t\t\tZone:                 zone,\n\t\t\tLBID:                 fi.ValueOf(expected.LoadBalancer.LBID),\n\t\t\tName:                 fi.ValueOf(expected.Name),\n\t\t\tForwardProtocol:      lb.Protocol(fi.ValueOf(expected.ForwardProtocol)),","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/scalewaytasks/lb_backend.go#L136-L172","documentation":"In LBBackend.RenderScw, when an existing backend differs from expected, kOps calls lb.ZonedAPI.UpdateBackend with the changed fields (port, protocol, algorithm, sticky sessions, proxy protocol). This error wraps a failure of that UpdateBackend call — the backend was found but could not be modified. Typically the request payload is rejected by Scaleway validation or the backend/LB is in a state that disallows updates.","triggerScenarios":"lbService.UpdateBackend(&lb.ZonedAPIUpdateBackendRequest{...}) returns an error: invalid enum value cast from expected.ForwardPortAlgorithm/StickySessions/ProxyProtocol (invalid_argument), backend ID not found (deleted mid-apply), LB in 'resetting'/'migrating' transient state, or quota/validation rejection of the port/protocol combination.","commonSituations":"Cluster spec contains values outside Scaleway's accepted enums (e.g. proxy protocol string without the expected prefix, bad forward-port-algorithm like 'leastconn' vs 'roundrobin'/'first'/'leastconn' spelling); concurrent apply racing a Scaleway LB maintenance state; backend deleted manually during apply; permissions lacking lb edit rights.","solutions":["Validate the cluster spec values against Scaleway enums: forward_port_algorithm (roundrobin|first|leastconn), sticky_sessions (none|cookie|table), proxy_protocol (proxy_protocol_v1|proxy_protocol_v2|proxy_protocol_unknown).","Confirm the backend still exists (`scw lb backend list <lb-id>`) and re-run `kops update cluster` if it was deleted mid-apply.","Wait for the LB to leave transient states (resetting/migrating) — `scw lb lb get` — then retry the apply.","Check the SCW key has write permissions on the LB resource (IAM policy).","If a validation error persists, run with --v=8 to inspect the exact UpdateBackend payload and fix the offending spec field."],"exampleFix":"// before: spec value not a valid Scaleway enum\nForwardPortAlgorithm: fi.ValueOf(\"leastconn-tls\")\n// after: use an accepted Scaleway ForwardPortAlgorithm value\nForwardPortAlgorithm: fi.ValueOf(\"leastconn\")","handlingStrategy":"validation","validationCode":"// validate enum-ish fields against Scaleway's accepted values before apply\nvar validAlgorithms = map[string]bool{\"roundrobin\": true, \"first\": true, \"leastconn\": true}\nvar validSticky = map[string]bool{\"none\": true, \"cookie\": true, \"table\": true}\nvar validProxy = map[string]bool{\"proxy_protocol_none\": true, \"proxy_protocol_v1\": true, \"proxy_protocol_v2\": true}\nif !validAlgorithms[fi.ValueOf(b.ForwardPortAlgorithm)] ||\n   !validSticky[fi.ValueOf(b.StickySessions)] ||\n   !validProxy[fi.ValueOf(b.ProxyProtocol)] {\n    return fmt.Errorf(\"invalid backend enum in cluster spec\")\n}","typeGuard":"func validBackendEnums(b *LBBackend) bool {\n    switch lb.ForwardPortAlgorithm(fi.ValueOf(b.ForwardPortAlgorithm)) {\n    case lb.ForwardPortAlgorithmRoundrobin, lb.ForwardPortAlgorithmFirst, lb.ForwardPortAlgorithmLeastconn:\n    default: return false\n    }\n    switch lb.ProxyProtocol(fi.ValueOf(b.ProxyProtocol)) {\n    case lb.ProxyProtocolProxyProtocolNone, lb.ProxyProtocolProxyProtocolV1, lb.ProxyProtocolProxyProtocolV2, lb.ProxyProtocolProxyProtocolUnknown:\n    default: return false\n    }\n    return true\n}","tryCatchPattern":"_, err := lbService.UpdateBackend(req)\nif err != nil {\n    var respErr *scw.ResponseError\n    if errors.As(err, &respErr) && respErr.StatusCode == 409 {\n        return fmt.Errorf(\"LB in transient state, retry: %w\", err) // retry after WaitForLb\n    }\n    return fmt.Errorf(\"updating back-end for load-balancer %s: %w\", fi.ValueOf(actual.LoadBalancer.Name), err)\n}","preventionTips":["Only use enum values accepted by scaleway-sdk-go lb types in the cluster spec","Call WaitForLb before UpdateBackend so the LB is 'ready'","Avoid concurrent applies to the same load balancer","Grant the kOps API key LB write permissions in IAM","Test spec changes with `kops update cluster --dry-run` first"],"tags":["scaleway","load-balancer","backend","validation"],"backgroundTag":"api-update-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"}