{"record":{"id":"28f6b1821b94ac0e","repo":"kubernetes/kops","slug":"getting-vmss-vm-w","errorCode":null,"errorMessage":"getting VMSS VM: %w","messagePattern":"getting VMSS VM: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/nodeidentity/azure/client.go","lineNumber":90,"sourceCode":"\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}\n}\n","sourceCodeStart":72,"sourceCodeEnd":97,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/nodeidentity/azure/client.go#L72-L97","documentation":"When the parsed providerID identifies a scale-set instance (Microsoft.Compute/virtualMachineScaleSets/virtualMachines), getVMTags calls the VMSS VMs client Get API to fetch the instance and its tags. Failure of that API call is wrapped with 'getting VMSS VM'.","triggerScenarios":"c.vmssClient.Get(ctx, resourceGroup, scaleSetName, instanceID, nil) returns an error — instance no longer exists (scaled in / deallocated), wrong parent scale-set name in the providerID, RBAC denial, or API/network failure.","commonSituations":"Node object from an instance that was scaled in by autoscaling; VMSS renamed or recreated; managed identity missing Reader on the resource group; stale providerID after cluster upgrade.","solutions":["Check the wrapped error: 404 means the scale-set instance is gone — delete the stale Node object (kubectl delete node <name>)","Verify the VMSS and instance exist: az vmss list-instances -g <rg> -n <vmss-name>","Ensure the identity has Reader role on the VMSS resource group","Retry on transient (5xx/429) errors; verify the parent scale-set name segment in the providerID is correct"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify the VMSS instance exists before the call\naz vmss list-instances -g <resource-group> -n <scale-set-name> --query \"[].instanceId\" -o tsv","typeGuard":null,"tryCatchPattern":"resp, err := c.vmssClient.Get(ctx, rg, vmssName, instanceID, nil)\nif err != nil {\n    var respErr *azcore.ResponseError\n    if errors.As(err, &respErr) && respErr.StatusCode == 404 {\n        // instance scaled in; delete stale Node object\n    } else if respErr != nil && (respErr.StatusCode == 429 || respErr.StatusCode >= 500) {\n        // transient: retry with backoff\n    }\n    return fmt.Errorf(\"getting VMSS VM: %w\", err)\n}","preventionTips":["Expect 404s from autoscaling scale-ins and treat them as node removal, not failure","Grant the identity Reader on the VMSS resource group","Retry 429/5xx with exponential backoff","Keep VMSS names in providerIDs consistent across cluster upgrades"],"tags":["azure","api","vmss","permissions"],"backgroundTag":"azure-resource-not-found","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"}