{"record":{"id":"89aafe510aafca02","repo":"kubernetes/kops","slug":"failed-to-parse-loadbalancer-id-s","errorCode":null,"errorMessage":"failed to parse loadbalancer ID %s","messagePattern":"failed to parse loadbalancer ID (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azuretasks/vmscaleset.go","lineNumber":162,"sourceCode":"\t\treturn nil, fmt.Errorf(\"found VMSS without IP config subnet\")\n\t}\n\tif ipConfig.Properties.Subnet.ID == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without IP config subnet ID\")\n\t}\n\tsubnetID, err := azure.ParseSubnetID(*ipConfig.Properties.Subnet.ID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse subnet ID %s\", *ipConfig.Properties.Subnet.ID)\n\t}\n\n\tvar loadBalancerID *azure.LoadBalancerID\n\tif ipConfig.Properties.LoadBalancerBackendAddressPools != nil {\n\t\tfor _, i := range ipConfig.Properties.LoadBalancerBackendAddressPools {\n\t\t\tif !strings.Contains(*i.ID, \"api\") {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tloadBalancerID, err = azure.ParseLoadBalancerID(*i.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to parse loadbalancer ID %s\", *i.ID)\n\t\t\t}\n\t\t}\n\t}\n\n\tosProfile := profile.OSProfile\n\tif osProfile.LinuxConfiguration == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without Linux config\")\n\t}\n\tif osProfile.LinuxConfiguration.SSH == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without SSH config\")\n\t}\n\tif osProfile.LinuxConfiguration.SSH.PublicKeys == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without SSH public keys\")\n\t}\n\tsshKeys := osProfile.LinuxConfiguration.SSH.PublicKeys\n\tif len(sshKeys) != 1 {\n\t\treturn nil, fmt.Errorf(\"expecting exactly 1 SSH key for %q, found %d: %+v\", *s.Name, len(sshKeys), sshKeys)\n\t}","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azuretasks/vmscaleset.go#L144-L180","documentation":"When a VMSS IP configuration lists load balancer backend address pools, Find() looks for pools whose ID contains \"api\" (the API load balancer kOps manages) and parses the pool's ARM ID with azure.ParseLoadBalancerID to recover the load balancer name and resource group. This error fires when that ID string is not a valid load balancer backend address pool resource ID.","triggerScenarios":"Find() on a VMSS whose ipConfigurations[].loadBalancerBackendAddressPools contains an entry containing \"api\" in its ID, but the ID fails azure.ParseLoadBalancerID (malformed path, missing segments, wrong provider).","commonSituations":"Load balancer pools attached by other tools or manual portal edits with non-standard IDs; kops-created cluster where the API load balancer was renamed/recreated externally; SDK/API version differences altering ID casing or shape.","solutions":["Print the pool IDs with `az vmss show ... --query \"virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].loadBalancerBackendAddressPools\"` and verify each is a canonical backendAddressPools ARM ID.","Restore the load balancer backend pool reference to the kops-managed one by re-running `kops update cluster --yes` (or delete the foreign pool association).","If a valid new ID format is rejected, update azure.ParseLoadBalancerID to handle it and add a regression test.","Avoid manual edits to load balancers in kops-managed clusters."],"exampleFix":"// before\n\"/subscriptions/.../Microsoft.Network/loadBalancers/api/backendAddressPools\"\n// after (full canonical form)\n\"/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/loadBalancers/<lb-name>/backendAddressPools/<pool-name>\"","handlingStrategy":"validation","validationCode":"re := regexp.MustCompile(`^/subscriptions/[^/]+/resourceGroups/[^/]+/providers/Microsoft\\.Network/loadBalancers/[^/]+/backendAddressPools/[^/]+$`)\nif !re.MatchString(poolID) { return fmt.Errorf(\"malformed backend pool ID: %s\", poolID) }","typeGuard":null,"tryCatchPattern":"lbID, err := azure.ParseLoadBalancerID(id)\nif err != nil {\n  return fmt.Errorf(\"kops: unusable load balancer pool ID %q: %w\", id, err)\n}","preventionTips":["Do not attach foreign load balancer pools to kops-managed VMSS","Keep load balancer names matching kops conventions (api lb contains \"api\")","Reconcile with kops update cluster before manual LB changes","Test ParseLoadBalancerID against your environment's IDs"],"tags":["azure","vmss","loadbalancer","resource-id"],"backgroundTag":"azure-resource-id-parse-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"}