{"record":{"id":"c55ab098b1f0e03b","repo":"kubernetes/kops","slug":"unknown-providerid-s","errorCode":null,"errorMessage":"unknown providerID : %s","messagePattern":"unknown providerID : (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/azure/client.go","lineNumber":72,"sourceCode":"\tvmClient, err := compute.NewVirtualMachinesClient(metadata.SubscriptionID, cred, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating VMs client: %w\", err)\n\t}\n\n\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)","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/azure/client.go#L54-L90","documentation":"getVMTags expects a providerID with the 'azure://' scheme (e.g. azure:///subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Compute/virtualMachines/<vm>). If the providerID lacks this prefix it cannot be an Azure resource ID, so the error 'unknown providerID' is thrown before parsing.","triggerScenarios":"getVMTags (via IdentifyNode) is called with node.Spec.ProviderID that does not start with 'azure://' — e.g. an empty-looking, GCE-style ('gce://'), AWS-style ('aws://'), or otherwise malformed providerID slipped through the caller's prefix check.","commonSituations":"Node object was not created by the Azure cloud provider (imported/foreign cluster state); cloud-controller-manager failed to set providerID; providerID set manually with wrong scheme; mixed-provider clusters.","solutions":["Verify node.Spec.ProviderID starts with 'azure://' — inspect with kubectl get node <name> -o jsonpath='{.spec.providerID}'","Ensure the Azure cloud controller manager is running and labeling nodes with proper providerIDs","Delete/replace the mislabeled node object so the cloud provider recreates it with a valid providerID","If you control the caller, replicate the same strings.HasPrefix(providerID, \"azure://\") guard that IdentifyNode performs before calling getVMTags"],"exampleFix":"// before (caller passes providerID unchecked)\ntags, err := c.getVMTags(ctx, node.Spec.ProviderID)\n\n// after (guard with same prefix check as IdentifyNode)\npid := node.Spec.ProviderID\nif !strings.HasPrefix(pid, \"azure://\") {\n    return nil, fmt.Errorf(\"providerID %q not recognized for node %q\", pid, node.Name)\n}\ntags, err := c.getVMTags(ctx, pid)","handlingStrategy":"validation","validationCode":"func isValidAzureProviderID(pid string) bool {\n    return strings.HasPrefix(pid, \"azure://\")\n}","typeGuard":"func isAzureProviderID(pid string) bool {\n    return strings.HasPrefix(pid, \"azure://\")\n}","tryCatchPattern":"tags, err := getVMTags(ctx, pid)\nif err != nil && strings.HasPrefix(err.Error(), \"unknown providerID\") {\n    // providerID is not azure; route to the correct cloud's identifier\n}","preventionTips":["Check node.Spec.ProviderID scheme before calling Azure-specific code","Ensure the Azure cloud controller manager sets providerIDs","Watch for manually edited node specs with wrong schemes"],"tags":["azure","providerid","validation","node"],"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-12T12:17:11.808Z"}