kubernetes/kops · error
error retrieving subnet with id %s: %v
Error message
error retrieving subnet with id %s: %v
What it means
Resolving a network by subnet ID failed because the GetSubnet call for that ID errored. The lookup is retried with backoff; persistence means the subnet is unreachable, deleted, or the API/credentials are broken.
Source
Thrown at upup/pkg/fi/cloudup/openstack/network.go:82
if err != nil {
return err
} else if done {
return nil
} else {
return wait.ErrWaitTimeout
}
}
func (c *openstackCloud) FindNetworkBySubnetID(subnetID string) (*networks.Network, error) {
return findNetworkBySubnetID(c, subnetID)
}
func findNetworkBySubnetID(c OpenstackCloud, subnetID string) (*networks.Network, error) {
var rslt *networks.Network
done, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {
subnet, err := c.GetSubnet(subnetID)
if err != nil {
return false, fmt.Errorf("error retrieving subnet with id %s: %v", subnetID, err)
}
netID := subnet.NetworkID
net, err := c.GetNetwork(netID)
if err != nil {
return false, fmt.Errorf("error retrieving network with id %s: %v", netID, err)
}
rslt = net
return true, nil
})
if err != nil {
return nil, err
} else if done {
return rslt, nil
} else {
return nil, wait.ErrWaitTimeout
}
}View on GitHub (pinned to 4c8573c808)
Example fix
// before subnetID: "bad-id" // after subnetID: "0f3d1a1e-..." # from `openstack subnet list`
Defensive patterns
Strategy: validation
Validate before calling
// verify subnet exists and is accessible before calling findNetworkBySubnetID subnet, err := osClient.NetworkingV2().Subnets.Get(ctx, subnetID).Extract() // err must be nil and subnet must belong to the target project
Type guard
func subnetExists(c openstack.OpenstackCloud, id string) bool {
_, err := c.GetSubnet(id)
return err == nil
} Try / catch
net, err := findNetworkBySubnetID(c, subnetID)
if err != nil {
return fmt.Errorf("check subnetID %q: %w", subnetID, err)
} Prevention
- Copy subnet IDs from `openstack subnet list` to avoid typos
- Ensure cluster spec subnet belongs to the same project/region as credentials
- Don't delete subnets referenced by cluster specs
When it happens
Trigger: GetSubnet returns 404 (subnet ID wrong or deleted), 403 (project lacks access to the subnet), or a network/API error.
Common situations: Cluster spec references a subnetID from another project/region; subnet deleted out-of-band; typo in subnet ID; Neutron API outage.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- error retrieving subnet: %v
- error listing subnets in network %q: %v
- error retrieving network with id %s: %v
- error listing subnets: %v
- error extracting subnets from pages: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/677e30c667247367.
Report an issue: GitHub.