kubernetes/kops · error

listing public ip addresses: %w

Error message

listing public ip addresses: %w

What it means

This error wraps any failure returned by the Azure SDK pager while iterating pages of public IP addresses in a resource group. kOps' publicIPAddressesClientImpl.List uses azcore's pager; when NextPage fails for any reason other than a tolerable ResourceGroupNotFound, it is wrapped with this message. The underlying cause (auth, network, throttling, bad subscription) is preserved in the wrapped error chain.

Source

Thrown at upup/pkg/fi/cloudup/azure/publicipaddress.go:68

	}
	return &resp.PublicIPAddress, err
}

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

	var l []*network.PublicIPAddress
	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 public ip addresses: %w", err)
		}
		l = append(l, resp.Value...)
	}
	return l, nil
}

func (c *publicIPAddressesClientImpl) Delete(ctx context.Context, resourceGroupName, publicIPAddressName string) error {
	future, err := c.c.BeginDelete(ctx, resourceGroupName, publicIPAddressName, nil)
	if err != nil {
		return fmt.Errorf("deleting public ip address: %w", err)
	}
	if _, err := future.PollUntilDone(ctx, nil); err != nil {
		return fmt.Errorf("waiting for public ip address deletion completion: %w", err)
	}
	return nil
}

func newPublicIPAddressesClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*publicIPAddressesClientImpl, error) {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run 'az login' and 'az account set --subscription <id>' to refresh credentials and confirm the subscription ID passed to newAzureCloud is correct
  2. Verify the identity has Reader on the resource group (Microsoft.Network/publicIPAddresses/read)
  3. Inspect the wrapped error via errors.As(err, *azcore.ResponseError) to read StatusCode/ErrorCode and act on it (retry 429/503)
  4. Retry the listing after a backoff if the error is throttling or transient
Defensive patterns

Strategy: try-catch

Validate before calling

if subID == "" || cred == nil { return errors.New("azure: subscription ID and credentials required before listing public IPs") }
if err := azidentity.NewDefaultAzureCredential(nil); err != nil { /* resolve auth first */ }

Type guard

var respErr *azcore.ResponseError
if errors.As(err, &respErr) { return respErr.StatusCode, respErr.ErrorCode }

Try / catch

_, err := client.List(ctx)
var re *azcore.ResponseError
if errors.As(err, &re) {
  if re.StatusCode == 429 || re.StatusCode >= 500 { /* retry with backoff */ }
  return fmt.Errorf("list public IPs (code=%s): %w", re.ErrorCode, err)
}

Prevention

When it happens

Trigger: Calling List(ctx) on publicIPAddressesClientImpl when pager.NextPage(ctx) returns an error whose ErrorCode is not 'ResourceGroupNotFound' — e.g. invalid subscription ID, expired/missing Azure credentials, network failure, or ARM throttling (429).

Common situations: Azure CLI login expired (az login needed); AZURE_SUBSCRIPTION_ID wrong or pointing to a deleted subscription; RBAC lacks Microsoft.Network/publicIPAddresses/read; transient ARM 429/503 during cluster listing.

Related errors


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