kubernetes/kops · error

waiting for virtual network create/update completion: %w

Error message

waiting for virtual network create/update completion: %w

What it means

Wrapped when the long-running operation started by BeginCreateOrUpdate fails or is cancelled during future.PollUntilDone. The Begin call succeeded, but provisioning later returned an error (provisioning failed, context cancelled, timeout, ARM returned a failed operation). This is the polling-stage counterpart of the 'creating/updating virtual network' error.

Source

Thrown at upup/pkg/fi/cloudup/azure/virtualnetwork.go:49

	CreateOrUpdate(ctx context.Context, resourceGroupName, virtualNetworkName string, parameters network.VirtualNetwork) (*network.VirtualNetwork, error)
	List(ctx context.Context, resourceGroupName string) ([]*network.VirtualNetwork, error)
	Delete(ctx context.Context, resourceGroupName, vnetName string) error
}

type virtualNetworksClientImpl struct {
	c *network.VirtualNetworksClient
}

var _ VirtualNetworksClient = (*virtualNetworksClientImpl)(nil)

func (c *virtualNetworksClientImpl) CreateOrUpdate(ctx context.Context, resourceGroupName, virtualNetworkName string, parameters network.VirtualNetwork) (*network.VirtualNetwork, error) {
	future, err := c.c.BeginCreateOrUpdate(ctx, resourceGroupName, virtualNetworkName, parameters, nil)
	if err != nil {
		return nil, fmt.Errorf("creating/updating virtual network: %w", err)
	}
	vnet, err := future.PollUntilDone(ctx, nil)
	if err != nil {
		return nil, fmt.Errorf("waiting for virtual network create/update completion: %w", err)
	}
	return &vnet.VirtualNetwork, err
}

func (c *virtualNetworksClientImpl) List(ctx context.Context, resourceGroupName string) ([]*network.VirtualNetwork, error) {
	if resourceGroupName == "" {
		return nil, nil
	}

	var l []*network.VirtualNetwork
	pager := c.c.NewListPager(resourceGroupName, nil)
	for pager.More() {
		resp, err := pager.NextPage(ctx)
		if err != nil {
			var respErr *azcore.ResponseError
			if errors.As(err, &respErr) && respErr.ErrorCode == "ResourceGroupNotFound" {
				return nil, nil
			}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run kops; failed long-running operations can usually be retried once the transient cause is gone
  2. Check the vnet's provisioning state in the Azure portal / az network vnet show
  3. Increase the kops command timeout or keep the process alive during large topology changes
  4. Review Activity Log for the failed PUT operation to find the Azure-side error code
Defensive patterns

Strategy: retry

Validate before calling

// Go: ensure a generous, cancellation-safe context before the long-running call
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute)
defer cancel()

Try / catch

vnet, err := vnetsClient.CreateOrUpdate(ctx, rg, name, parameters)
if err != nil {
    if ctx.Err() != nil {
        return fmt.Errorf("cancelled/timed out while provisioning vnet %s; re-run kops to resume", name)
    }
    return fmt.Errorf("vnet provisioning failed, check Activity Log: %w", err)
}

Prevention

When it happens

Trigger: CreateOrUpdate's future.PollUntilDone(ctx, nil) returns an error because the vnet PUT operation reached a Failed/Cancelled terminal state, or ctx was cancelled/timed out mid-poll.

Common situations: Long vnet operations interrupted by kops context cancellation (Ctrl-C, timeout); Azure-side provisioning failure; quota/capacity errors surfacing during provisioning; ARM throttling exceeding the default retry window.

Related errors


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