{"record":{"id":"5d93f7dfad1a800b","repo":"kubernetes/kops","slug":"error-parsing-providerid-v","errorCode":null,"errorMessage":"error parsing providerID: %v","messagePattern":"error parsing providerID: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/azure/client.go","lineNumber":77,"sourceCode":"\tvmssClient, err := compute.NewVirtualMachineScaleSetVMsClient(metadata.SubscriptionID, cred, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating VMSS VMs client: %w\", err)\n\t}\n\n\treturn &client{\n\t\tvmClient:   vmClient,\n\t\tvmssClient: vmssClient,\n\t}, nil\n}\n\nfunc (c *client) getVMTags(ctx context.Context, providerID string) (map[string]*string, error) {\n\tif !strings.HasPrefix(providerID, \"azure://\") {\n\t\treturn nil, fmt.Errorf(\"unknown providerID : %s\", providerID)\n\t}\n\n\tres, err := arm.ParseResourceID(strings.TrimPrefix(providerID, \"azure://\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing providerID: %v\", err)\n\t}\n\n\tswitch res.ResourceType.String() {\n\tcase \"Microsoft.Compute/virtualMachines\":\n\t\tresp, err := c.vmClient.Get(ctx, res.ResourceGroupName, res.Name, nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"getting VM: %w\", err)\n\t\t}\n\t\treturn resp.VirtualMachine.Tags, nil\n\tcase \"Microsoft.Compute/virtualMachineScaleSets/virtualMachines\":\n\t\tresp, err := c.vmssClient.Get(ctx, res.ResourceGroupName, res.Parent.Name, res.Name, nil)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"getting VMSS VM: %w\", err)\n\t\t}\n\t\treturn resp.VirtualMachineScaleSetVM.Tags, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported resource type %q for %q\", res.ResourceType, providerID)\n\t}","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/azure/client.go#L59-L95","documentation":"After confirming the 'azure://' prefix, getVMTags strips it and parses the remainder as an Azure Resource Manager resource ID using arm.ParseResourceID. If the string is not a valid fully-qualified ARM ID, the parse error is wrapped with 'error parsing providerID'.","triggerScenarios":"The providerID is 'azure://' + a string that fails ARM ID parsing — e.g. 'azure://vmname' (bare hostname), missing segments like subscriptions/resourceGroups, or URL-encoded/truncated IDs.","commonSituations":"Older kops/Azure CCM formats that stored short VM names instead of full ARM URIs; manually edited node providerIDs; kubernetes/azure cloud provider versions emitting 'azure:///...' variants with missing segments; copy-paste truncation of the providerID.","solutions":["Set the providerID to the full ARM URI: azure:///subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.Compute/virtualMachines/<vm-name>","Check for legacy short providerID formats (e.g. azure://<vm-name>) and re-register/replace the node so CCM writes the canonical form","Validate the ID with arm.ParseResourceID locally to see the exact parse failure","Confirm matching kubernetes and cloud-provider-azure versions so providerID format expectations align"],"exampleFix":"// before\nproviderID = \"azure://k8s-agent-1\"  // bare name, not parseable\n\n// after\nproviderID = \"azure:///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/virtualMachines/k8s-agent-1\"","handlingStrategy":"validation","validationCode":"rest := strings.TrimPrefix(providerID, \"azure://\")\nif !strings.Contains(rest, \"/subscriptions/\") {\n    return fmt.Errorf(\"providerID %q is not a full ARM resource ID\", providerID)\n}\nif _, err := arm.ParseResourceID(rest); err != nil {\n    return fmt.Errorf(\"malformed providerID %q: %w\", providerID, err)\n}","typeGuard":"func isParseableARMID(pid string) bool {\n    _, err := arm.ParseResourceID(strings.TrimPrefix(pid, \"azure://\"))\n    return err == nil\n}","tryCatchPattern":"tags, err := getVMTags(ctx, pid)\nif err != nil && strings.HasPrefix(err.Error(), \"error parsing providerID\") {\n    // fall back to matching node by name or skip this node\n}","preventionTips":["Always store the full ARM URI form of the providerID","Avoid legacy short providerID formats (azure://<vm-name>)","Keep kubernetes and cloud-provider-azure versions aligned","Test arm.ParseResourceID on the ID format your cluster emits"],"tags":["azure","providerid","arm","parsing"],"backgroundTag":"invalid-providerid-format","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"}