kubernetes/kops · error

listing VMSSs: %w

Error message

listing VMSSs: %w

What it means

Wrapped when paging through virtual machine scale sets in a resource group fails in vmScaleSetsClientImpl.List (used by kops cloud verification's Run). As with vnet List, a ResourceGroupNotFound ResponseError is tolerated (returns nil, nil); every other pager error is wrapped. It signals that cluster inventory discovery could not enumerate VMSS instances.

Source

Thrown at upup/pkg/fi/cloudup/azure/vmscaleset.go:70

	}
	return &resp.VirtualMachineScaleSet, nil
}

func (c *vmScaleSetsClientImpl) List(ctx context.Context, resourceGroupName string) ([]*compute.VirtualMachineScaleSet, error) {
	if resourceGroupName == "" {
		return nil, nil
	}

	var l []*compute.VirtualMachineScaleSet
	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
			}
			return nil, fmt.Errorf("listing VMSSs: %w", err)
		}
		l = append(l, resp.Value...)
	}
	return l, nil
}

func (c *vmScaleSetsClientImpl) Get(ctx context.Context, resourceGroupName string, vmssName string) (*compute.VirtualMachineScaleSet, error) {
	opts := &compute.VirtualMachineScaleSetsClientGetOptions{
		Expand: to.Ptr(compute.ExpandTypesForGetVMScaleSetsUserData),
	}
	resp, err := c.c.Get(ctx, resourceGroupName, vmssName, opts)
	if err != nil {
		return nil, fmt.Errorf("getting VMSS: %w", err)
	}
	return &resp.VirtualMachineScaleSet, nil
}

func (c *vmScaleSetsClientImpl) Delete(ctx context.Context, resourceGroupName, vmssName string) error {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Grant the principal Reader/Contributor on the resource group (check for AuthorizationFailed in the wrapped error)
  2. Retry with backoff if the error is 429/throttling
  3. Confirm the resource group name in the cluster spec matches Azure (missing groups return empty, other errors do not)
  4. Inspect errors.Unwrap for the underlying azcore.ResponseError code
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: ensure RBAC read access before enumerating VMSSs
// az role assignment create --assignee <principal> --role Reader --resource-group <rg>
if resourceGroup == "" {
    return fmt.Errorf("resource group is required to list VMSSs")
}

Type guard

func isThrottled(err error) bool {
    var respErr *azcore.ResponseError
    return errors.As(err, &respErr) && respErr.StatusCode == http.StatusTooManyRequests
}

Try / catch

vmssList, err := vmssClient.List(ctx, rg)
if err != nil {
    var respErr *azcore.ResponseError
    if errors.As(err, &respErr) && respErr.StatusCode == http.StatusTooManyRequests {
        time.Sleep(retryAfter(respErr))
        vmssList, err = vmssClient.List(ctx, rg)
    }
    if err != nil {
        return fmt.Errorf("VMSS enumeration failed (check RBAC/ResourceGroup): %w", err)
    }
}

Prevention

When it happens

Trigger: List's pager.NextPage(ctx) returns an error other than ResponseError with ErrorCode ResourceGroupNotFound — e.g. AuthorizationFailed, TooManyRequests (429), or a transient network failure.

Common situations: Verification against a cluster whose resource group was deleted concurrently (non-404 error path); service principal lacking Microsoft.Compute read; ARM throttling during large verifications; SDK paging across many VMSSs hitting intermittent failures.

Related errors


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