{"record":{"id":"d956ead349b5b78f","repo":"kubernetes/kops","slug":"found-vmss-without-id","errorCode":null,"errorMessage":"found VMSS without ID","messagePattern":"found VMSS without ID","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azuretasks/vmscaleset.go","lineNumber":106,"sourceCode":"\n// CompareWithID returns the Name of the VM Scale Set.\nfunc (s *VMScaleSet) CompareWithID() *string {\n\treturn s.Name\n}\n\n// Find discovers the VMScaleSet in the cloud provider.\nfunc (s *VMScaleSet) Find(c *fi.CloudupContext) (*VMScaleSet, error) {\n\tcloud := c.T.Cloud.(azure.AzureCloud)\n\tfound, err := cloud.VMScaleSet().Get(context.TODO(), *s.ResourceGroup.Name, *s.Name)\n\tif err != nil && !strings.Contains(err.Error(), \"NotFound\") {\n\t\treturn nil, err\n\t}\n\tif found == nil {\n\t\treturn nil, nil\n\t}\n\n\tif found.ID == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without ID\")\n\t}\n\tif found.Properties == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without properties\")\n\t}\n\tif fi.ValueOf(found.Properties.ProvisioningState) == \"Failed\" {\n\t\tklog.Warningf(\"found VMSS %q in failed provisioning state\", *s.Name)\n\t\treturn nil, nil\n\t}\n\tif found.Properties.VirtualMachineProfile == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without VM profile\")\n\t}\n\tif found.Properties.VirtualMachineProfile.NetworkProfile == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without network profile\")\n\t}\n\tif found.Properties.VirtualMachineProfile.OSProfile == nil {\n\t\treturn nil, fmt.Errorf(\"found VMSS without OS profile\")\n\t}\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azuretasks/vmscaleset.go#L88-L124","documentation":"This error is returned by VMScaleSet.Find when the Azure SDK returned a VirtualMachineScaleSet resource whose ID field is nil. Find uses the ID to locate the VMSS and to parse resource identifiers (e.g. resource group), so a scale set without an ID cannot be reconciled. It is a defensive invariant check against malformed/incomplete Azure API responses.","triggerScenarios":"Calling Find (during kops cluster reconciliation) when the List/Get VirtualMachineScaleSets call returns a scale set model whose ID pointer is nil — e.g. a partially created or corrupted VMSS entry returned by the Azure API.","commonSituations":"Azure API returning partially-initialized resources during rapid create/delete cycles; stubbed or mocked SDK responses in tests missing ID; stale cache or an SDK version change altering response population.","solutions":["Re-run the operation after the VMSS has fully materialized in Azure (ID is always set on committed resources).","Delete and recreate the orphaned/partially-created VMSS in the Azure portal or via az vmss delete.","If seen in tests, populate the ID field in the mocked VirtualMachineScaleSet response.","Check the Azure SDK (azure-sdk-for-go) version matches what kops expects and responses are fully populated."],"exampleFix":"// before (test mock)\nfound := &compute.VirtualMachineScaleSet{Name: &name}\n// after\nfound := &compute.VirtualMachineScaleSet{Name: &name, ID: &id}","handlingStrategy":"validation","validationCode":"vmss, _ := cloud.VirtualMachineScaleSets().Get(ctx, rg, name, nil)\nif vmss == nil || vmss.ID == nil {\n    return fmt.Errorf(\"VMSS %s has no ID; re-apply to recreate it\", name)\n}","typeGuard":"func hasID(v *compute.VirtualMachineScaleSet) bool { return v != nil && v.ID != nil }","tryCatchPattern":"result, err := findVMSS(ctx, name)\nif err != nil {\n    if strings.Contains(err.Error(), \"without ID\") {\n        return retryAfterReapply(err)\n    }\n    return err\n}","preventionTips":["Always run apply through kops rather than creating VMSS resources manually.","Populate ID in test fixtures for VirtualMachineScaleSet.","Re-run apply after Azure create/delete operations complete."],"tags":["azure","vmss","missing-id"],"backgroundTag":"azure-resource-missing-id","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"}