cilium/cilium · error
failed to parse instance ID %q
Error message
failed to parse instance ID %q
What it means
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.
Source
Thrown at pkg/azure/api/api.go:432
// without making additional Azure API calls
func (c *Client) ParseInterfacesIntoInstanceMap(networkInterfaces []*armnetwork.Interface, subnets ipamTypes.SubnetMap) *ipamTypes.InstanceMap {
instances := ipamTypes.NewInstanceMap()
for _, iface := range networkInterfaces {
if instanceID, azureInterface := parseInterface(c.logger, iface, subnets, c.usePrimary); instanceID != "" {
instances.Update(instanceID, azureInterface)
}
}
return instances
}
// ListVMNetworkInterfaces returns all network interfaces for a specific VMSS instance
// This is exposed to allow callers to fetch network interfaces once and parse them multiple times
func (c *Client) ListVMNetworkInterfaces(ctx context.Context, instanceID string) ([]*armnetwork.Interface, error) {
resourceID, err := arm.ParseResourceID(instanceID)
if err != nil {
return nil, fmt.Errorf("failed to parse instance ID %q", instanceID)
}
if strings.ToLower(resourceID.ResourceType.Type) != "virtualmachinescalesets/virtualmachines" {
return nil, fmt.Errorf("instance %q is not a virtual machine scale set instance", instanceID)
}
return c.listVirtualMachineScaleSetVMNetworkInterfaces(ctx, resourceID.Parent.Name, resourceID.Name)
}
// ParseInterfacesIntoInstance parses network interfaces into an Instance
// This allows re-parsing the same network interface data with different subnet maps
// without making additional Azure API calls
func (c *Client) ParseInterfacesIntoInstance(networkInterfaces []*armnetwork.Interface, subnets ipamTypes.SubnetMap) *ipamTypes.Instance {
instance := ipamTypes.Instance{}
instance.Interfaces = map[string]ipamTypes.Interface{}
for _, networkInterface := range networkInterfaces {
_, azureInterface := parseInterface(c.logger, networkInterface, subnets, c.usePrimary)
instance.Interfaces[azureInterface.ID] = azureInterfaceView on GitHub (pinned to ac7b90affa)
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
Example fix
// before nics, err := client.ListVMNetworkInterfaces(ctx, "vmss-agent-0") // after nics, err := client.ListVMNetworkInterfaces(ctx, "/subscriptions/sub-1/resourceGroups/rg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss-agent/virtualMachines/0")
Defensive patterns
Strategy: validation
Validate before calling
r, err := arm.ParseResourceID(providerID)
if err != nil { return fmt.Errorf("node providerID is not an ARM resource ID: %q", providerID) }
if strings.ToLower(r.ResourceType.Type) != "virtualmachinescalesets/virtualmachines" {
return fmt.Errorf("providerID must reference a VMSS VM")
} Type guard
func isVMSSInstanceID(id string) bool {
r, err := arm.ParseResourceID(id)
if err != nil { return false }
return strings.ToLower(r.ResourceType.Type) == "virtualmachinescalesets/virtualmachines"
} Try / catch
nics, err := client.ListVMNetworkInterfaces(ctx, instanceID)
if err != nil && strings.Contains(err.Error(), "failed to parse instance ID") {
return fmt.Errorf("providerID malformed; expected /subscriptions/.../virtualMachineScaleSets/.../virtualMachines/...: %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- instance %q is not a virtual machine scale set instance
- failed to parse subnet ID %q: %w
- unexpected trailing @
- invalid l4 addr format. expected <proto>/<port>
- unknown level
AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31).
Data as JSON: /api/errors/29b68bd330ba3141.
Report an issue: GitHub.