kubernetes/kops · error

found VMSS without ID

Error message

found VMSS without ID

What it means

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.

Source

Thrown at upup/pkg/fi/cloudup/azuretasks/vmscaleset.go:106

// CompareWithID returns the Name of the VM Scale Set.
func (s *VMScaleSet) CompareWithID() *string {
	return s.Name
}

// Find discovers the VMScaleSet in the cloud provider.
func (s *VMScaleSet) Find(c *fi.CloudupContext) (*VMScaleSet, error) {
	cloud := c.T.Cloud.(azure.AzureCloud)
	found, err := cloud.VMScaleSet().Get(context.TODO(), *s.ResourceGroup.Name, *s.Name)
	if err != nil && !strings.Contains(err.Error(), "NotFound") {
		return nil, err
	}
	if found == nil {
		return nil, nil
	}

	if found.ID == nil {
		return nil, fmt.Errorf("found VMSS without ID")
	}
	if found.Properties == nil {
		return nil, fmt.Errorf("found VMSS without properties")
	}
	if fi.ValueOf(found.Properties.ProvisioningState) == "Failed" {
		klog.Warningf("found VMSS %q in failed provisioning state", *s.Name)
		return nil, nil
	}
	if found.Properties.VirtualMachineProfile == nil {
		return nil, fmt.Errorf("found VMSS without VM profile")
	}
	if found.Properties.VirtualMachineProfile.NetworkProfile == nil {
		return nil, fmt.Errorf("found VMSS without network profile")
	}
	if found.Properties.VirtualMachineProfile.OSProfile == nil {
		return nil, fmt.Errorf("found VMSS without OS profile")
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run the operation after the VMSS has fully materialized in Azure (ID is always set on committed resources).
  2. Delete and recreate the orphaned/partially-created VMSS in the Azure portal or via az vmss delete.
  3. If seen in tests, populate the ID field in the mocked VirtualMachineScaleSet response.
  4. Check the Azure SDK (azure-sdk-for-go) version matches what kops expects and responses are fully populated.

Example fix

// before (test mock)
found := &compute.VirtualMachineScaleSet{Name: &name}
// after
found := &compute.VirtualMachineScaleSet{Name: &name, ID: &id}
Defensive patterns

Strategy: validation

Validate before calling

vmss, _ := cloud.VirtualMachineScaleSets().Get(ctx, rg, name, nil)
if vmss == nil || vmss.ID == nil {
    return fmt.Errorf("VMSS %s has no ID; re-apply to recreate it", name)
}

Type guard

func hasID(v *compute.VirtualMachineScaleSet) bool { return v != nil && v.ID != nil }

Try / catch

result, err := findVMSS(ctx, name)
if err != nil {
    if strings.Contains(err.Error(), "without ID") {
        return retryAfterReapply(err)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/d956ead349b5b78f. Report an issue: GitHub.