{"record":{"id":"a856cf5f18a652e6","repo":"kubernetes/kops","slug":"error-parsing-providerid-v-a856cf","errorCode":null,"errorMessage":"error parsing providerID: %v","messagePattern":"error parsing providerID: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/azure/identify.go","lineNumber":161,"sourceCode":"\t}\n\n\treturn info, nil\n}\n\n// stringKeyFunc is a string as cache key function\nfunc stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}\n\nfunc getVMNameFromProviderID(providerID string) (string, error) {\n\tif !strings.HasPrefix(providerID, \"azure://\") {\n\t\treturn \"\", fmt.Errorf(\"providerID %q not recognized\", providerID)\n\t}\n\n\tres, err := arm.ParseResourceID(strings.TrimPrefix(providerID, \"azure://\"))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error parsing providerID: %v\", err)\n\t}\n\n\tswitch res.ResourceType.String() {\n\tcase \"Microsoft.Compute/virtualMachines\":\n\t\treturn res.Name, nil\n\tcase \"Microsoft.Compute/virtualMachineScaleSets/virtualMachines\":\n\t\treturn res.Parent.Name + \"_\" + res.Name, nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported resource type %q for providerID %q\", res.ResourceType, providerID)\n\t}\n}\n","sourceCodeStart":143,"sourceCodeEnd":173,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/azure/identify.go#L143-L173","documentation":"Once the azure:// prefix is confirmed, the remainder of the providerID is parsed with arm.ParseResourceID (Azure SDK). If the string is not a valid fully-qualified ARM resource ID, this wrapped error is returned with the SDK's parse detail. The providerID must look like azure:///subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Compute/.../vmName.","triggerScenarios":"providerID has the azure:// scheme but a malformed body: missing subscription ID, wrong path segments (e.g. \"azure://vmname\"), URL-encoded or truncated IDs, or providerIDs produced by non-standard controllers.","commonSituations":"Clusters built with older/patched kubelet scripts that hand-wrote providerIDs; VM names or resource group names containing characters the SDK parser rejects; copying providerIDs from logs and losing segments; using an Azure SDK Go version where ParseResourceID is stricter.","solutions":["Print node.Spec.ProviderID and validate it against the ARM ID format for a VM or VMSS VM.","Re-stamp the providerID by restarting kubelet with the Azure cloud provider so it regenerates the canonical ID.","Upgrade the Azure SDK (sigs.k8s.io/cloud-provider-azure / azure-sdk-for-go) and kOps to versions whose formats match.","If the ID contains special characters, check resource/VM naming rules in Azure and rename or re-provision."],"exampleFix":"// before (hand-written providerID in cloud-config)\nproviderID: azure://myvm\n\n// after (canonical ARM form)\nproviderID: azure:///subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg/providers/Microsoft.Compute/virtualMachines/myvm","handlingStrategy":"validation","validationCode":"rest := strings.TrimPrefix(pid, \"azure://\")\nif _, err := arm.ParseResourceID(rest); err != nil {\n    return fmt.Errorf(\"providerID %q is not a valid ARM resource ID: %v\", pid, err)\n}","typeGuard":null,"tryCatchPattern":"name, err := getVMNameFromProviderID(pid)\nif err != nil && strings.Contains(err.Error(), \"error parsing providerID\") {\n    return fmt.Errorf(\"providerID %q malformed; re-stamp via kubelet azure cloud provider\", pid)\n}","preventionTips":["Never hand-write providerIDs; let the Azure CCM generate them","Validate providerIDs against the ARM ID regex in CI for golden manifests","Keep the Azure SDK and cloud-provider-azure versions aligned with kOps"],"tags":["azure","provider-id","parsing","arm-resource-id","kops"],"backgroundTag":"invalid-provider-id-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"}