kubernetes/kops · error

found virtual network without ID

Error message

found virtual network without ID

What it means

Malformed-API-object guard in the Azure virtual network Find: a VNet matching by name was returned but its ID field is nil, so kOps cannot build the resource reference. Indicates a broken API response, since Azure always assigns IDs to existing resources.

Source

Thrown at upup/pkg/fi/cloudup/azuretasks/virtualnetwork.go:72

func (n *VirtualNetwork) Find(c *fi.CloudupContext) (*VirtualNetwork, error) {
	cloud := c.T.Cloud.(azure.AzureCloud)
	l, err := cloud.VirtualNetwork().List(context.TODO(), *n.ResourceGroup.Name)
	if err != nil {
		return nil, err
	}
	var found *network.VirtualNetwork
	for _, v := range l {
		if *v.Name == *n.Name {
			found = v
			break
		}
	}
	if found == nil {
		return nil, nil
	}

	if found.ID == nil {
		return nil, fmt.Errorf("found virtual network without ID")
	}
	if found.Properties == nil {
		return nil, fmt.Errorf("found virtual network without properties")
	}
	if found.Properties.ProvisioningState != nil && *found.Properties.ProvisioningState == network.ProvisioningStateFailed {
		klog.Warningf("found virtual network %q in failed provisioning state", *n.Name)
		return nil, nil
	}
	if found.Properties.AddressSpace == nil {
		return nil, fmt.Errorf("found virtual network without address space")
	}

	addrPrefixes := found.Properties.AddressSpace.AddressPrefixes
	if len(addrPrefixes) != 1 {
		return nil, fmt.Errorf("expecting exactly 1 address prefix for %q, found %d: %+v", *n.Name, len(addrPrefixes), addrPrefixes)
	}
	return &VirtualNetwork{
		Name:      n.Name,

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Retry the operation for transient API issues
  2. Inspect the VNet in the Azure portal
  3. Recreate the VNet if it is in a corrupted state
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/azuretasks/virtualnetwork.go:72 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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