{"record":{"id":"29b68bd330ba3141","repo":"cilium/cilium","slug":"failed-to-parse-instance-id-q","errorCode":null,"errorMessage":"failed to parse instance ID %q","messagePattern":"failed to parse instance ID %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/azure/api/api.go","lineNumber":432,"sourceCode":"// without making additional Azure API calls\nfunc (c *Client) ParseInterfacesIntoInstanceMap(networkInterfaces []*armnetwork.Interface, subnets ipamTypes.SubnetMap) *ipamTypes.InstanceMap {\n\tinstances := ipamTypes.NewInstanceMap()\n\n\tfor _, iface := range networkInterfaces {\n\t\tif instanceID, azureInterface := parseInterface(c.logger, iface, subnets, c.usePrimary); instanceID != \"\" {\n\t\t\tinstances.Update(instanceID, azureInterface)\n\t\t}\n\t}\n\n\treturn instances\n}\n\n// ListVMNetworkInterfaces returns all network interfaces for a specific VMSS instance\n// This is exposed to allow callers to fetch network interfaces once and parse them multiple times\nfunc (c *Client) ListVMNetworkInterfaces(ctx context.Context, instanceID string) ([]*armnetwork.Interface, error) {\n\tresourceID, err := arm.ParseResourceID(instanceID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse instance ID %q\", instanceID)\n\t}\n\tif strings.ToLower(resourceID.ResourceType.Type) != \"virtualmachinescalesets/virtualmachines\" {\n\t\treturn nil, fmt.Errorf(\"instance %q is not a virtual machine scale set instance\", instanceID)\n\t}\n\n\treturn c.listVirtualMachineScaleSetVMNetworkInterfaces(ctx, resourceID.Parent.Name, resourceID.Name)\n}\n\n// ParseInterfacesIntoInstance parses network interfaces into an Instance\n// This allows re-parsing the same network interface data with different subnet maps\n// without making additional Azure API calls\nfunc (c *Client) ParseInterfacesIntoInstance(networkInterfaces []*armnetwork.Interface, subnets ipamTypes.SubnetMap) *ipamTypes.Instance {\n\tinstance := ipamTypes.Instance{}\n\tinstance.Interfaces = map[string]ipamTypes.Interface{}\n\n\tfor _, networkInterface := range networkInterfaces {\n\t\t_, azureInterface := parseInterface(c.logger, networkInterface, subnets, c.usePrimary)\n\t\tinstance.Interfaces[azureInterface.ID] = azureInterface","sourceCodeStart":414,"sourceCodeEnd":450,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/azure/api/api.go#L414-L450","documentation":"ListVMNetworkInterfaces couldn't parse the given instance ID as an Azure resource ID via arm.ParseResourceID, so it can't locate the VMSS VM's network interfaces. The raw instance ID is echoed in the error.","triggerScenarios":"instanceID is not a well-formed Azure resource manager ID (e.g. plain VM name, 'vmss-vm_0' without subscription/resource-group path, or empty string) when Cilium fetches NICs for a VMSS instance.","commonSituations":"Custom CNIs passing node names instead of full resource IDs; provider IDs stripped or reformatted by the cluster autoscaler; VMSS instances referenced with legacy naming not matching /virtualMachines/ path.","solutions":["Pass a full ARM resource ID like /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Compute/virtualMachineScaleSets/<vmss>/virtualMachines/<vm>","Verify the value comes from the node's spec.providerID and is not truncated","Ensure the resource ID targets a VMSS virtual machine (not standalone VM) as ListVMNetworkInterfaces requires","Trim whitespace or scheme prefixes (e.g. azure://) from the ID before calling"],"exampleFix":"// before\nnics, err := client.ListVMNetworkInterfaces(ctx, \"vmss-agent-0\")\n// after\nnics, err := client.ListVMNetworkInterfaces(ctx, \"/subscriptions/sub-1/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss-agent/virtualMachines/0\")","handlingStrategy":"validation","validationCode":"r, err := arm.ParseResourceID(providerID)\nif err != nil { return fmt.Errorf(\"node providerID is not an ARM resource ID: %q\", providerID) }\nif strings.ToLower(r.ResourceType.Type) != \"virtualmachinescalesets/virtualmachines\" {\n  return fmt.Errorf(\"providerID must reference a VMSS VM\")\n}","typeGuard":"func isVMSSInstanceID(id string) bool {\n  r, err := arm.ParseResourceID(id)\n  if err != nil { return false }\n  return strings.ToLower(r.ResourceType.Type) == \"virtualmachinescalesets/virtualmachines\"\n}","tryCatchPattern":"nics, err := client.ListVMNetworkInterfaces(ctx, instanceID)\nif err != nil && strings.Contains(err.Error(), \"failed to parse instance ID\") {\n  return fmt.Errorf(\"providerID malformed; expected /subscriptions/.../virtualMachineScaleSets/.../virtualMachines/...: %w\", err)\n}","preventionTips":["Always derive instance IDs from node.Spec.ProviderID, stripping 'azure://' scheme","Validate ARM ID format in admission webhooks","Ensure cluster uses VMSS nodes when calling this API","Log the full ID (not name) when diagnostics fail"],"tags":["azure","vmss","resource-id","parsing"],"backgroundTag":"invalid-azure-resource-id","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}