{"record":{"id":"b5e13c288afae4cc","repo":"kubernetes/kops","slug":"failed-to-parse-subnet-id-s","errorCode":null,"errorMessage":"failed to parse subnet ID %s","messagePattern":"failed to parse subnet ID (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azuretasks/vmscaleset.go","lineNumber":151,"sourceCode":"\t\treturn nil, fmt.Errorf(\"found VMSS without network interface config properties\")\n\t}\n\tipConfigs := nwConfig.Properties.IPConfigurations\n\tif len(ipConfigs) != 1 {\n\t\treturn nil, fmt.Errorf(\"expecting exactly 1 network interface IP config for %q, found %d: %+v\", *s.Name, len(ipConfigs), ipConfigs)\n\t}\n\tipConfig := ipConfigs[0]\n\tif ipConfig.Properties == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without IP config properties\")\n\t}\n\tif ipConfig.Properties.Subnet == nil {\n\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\")","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azuretasks/vmscaleset.go#L133-L169","documentation":"After Find confirms the IP config has a subnet ID, it parses the ARM resource ID string with azure.ParseSubnetID to extract the resource group, virtual network name, and subnet name. This error is returned when the ID string does not match the expected /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnet}/subnets/{subnet} shape.","triggerScenarios":"Find() encounters a VMSS IP configuration whose subnet.ID is non-nil but is not a well-formed Azure subnet resource ID (wrong provider path, missing segments, or a truncated/relative ID).","commonSituations":"Scale sets built by other tooling or templates that reference subnets with non-standard IDs; manual edits in the Azure portal or via ARM templates; casing/path changes across Azure API profile versions.","solutions":["Run `az vmss show -g <rg> -n <vmss> --query \"virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].subnet.id\"` and compare against the expected ARM format.","Fix the scale set's subnet reference so it is a full, canonical ARM subnet ID (e.g. via `az network nic ip-config update` equivalent or recreating through kops).","If parsing is too strict for a legitimate ID form, extend azure.ParseSubnetID to accept that form, then add a unit test.","Confirm all clusters are managed by a single kops version; upgrade kops and run `kops update cluster --yes` to reconcile out-of-band changes."],"exampleFix":"// before\n\"subnets/my-subnet\"\n// after\n\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/my-rg/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/my-subnet\"","handlingStrategy":"validation","validationCode":"re := regexp.MustCompile(`^/subscriptions/[^/]+/resourceGroups/[^/]+/providers/Microsoft\\.Network/virtualNetworks/[^/]+/subnets/[^/]+$`)\nif !re.MatchString(subnetID) { return fmt.Errorf(\"malformed subnet ID: %s\", subnetID) }","typeGuard":null,"tryCatchPattern":"subnetID, err := azure.ParseSubnetID(id)\nif err != nil {\n  return fmt.Errorf(\"kops: unusable subnet ID %q on VMSS: %w\", id, err)\n}","preventionTips":["Use only canonical full ARM resource IDs for subnet references","Avoid manual portal edits to kops-managed VMSS networking","Run `kops update cluster` regularly to detect drift early","Unit-test ParseSubnetID against IDs produced by your tooling"],"tags":["azure","vmss","resource-id","parsing"],"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"}