kubernetes/kops · error

Subnet.VPC.ID is required

Error message

Subnet.VPC.ID is required

What it means

Subnet.Find validation guard: fires when the Subnet task has a VPC reference with neither ID nor Name set (or Name is nil). Without a VPC identifier the task cannot look up the subnet, so reconciliation is aborted with this sentinel validation error.

Source

Thrown at upup/pkg/fi/cloudup/linodetasks/subnet.go:63

	}
	id := strconv.Itoa(fi.ValueOf(v.ID))
	return new(id)
}

func (v *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {
	cloud := c.T.Cloud.(linode.LinodeCloud)

	if v.VPC == nil {
		return nil, fmt.Errorf("Subnet.VPC is required")
	}
	if v.VPC.ID == nil {
		if v.VPC.Name != nil {
			if _, ok := c.Target.(*fi.CloudupDryRunTarget); ok {
				return nil, nil
			}
			return nil, fi.NewTryAgainLaterError("waiting for VPC ID")
		}
		return nil, fmt.Errorf("Subnet.VPC.ID is required")
	}

	subnets, err := cloud.Client().ListVPCSubnets(c.Context(), fi.ValueOf(v.VPC.ID), nil)
	if err != nil {
		return nil, fmt.Errorf("error listing Akamai (Linode) VPC Subnets: %w", err)
	}

	var foundByName *linodego.VPCSubnet
	var foundByIPv4 *linodego.VPCSubnet
	name := fi.ValueOf(v.Name)
	ipv4 := fi.ValueOf(v.IPv4)
	for i := range subnets {
		candidate := &subnets[i]
		if candidate.Label == name {
			if foundByName != nil {
				return nil, fmt.Errorf("found multiple Akamai (Linode) VPC Subnets named %q", name)
			}
			foundByName = candidate

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure the VPC task succeeds first so the subnet receives a resolved VPC ID
  2. Fix the spec so the VPC is identified (by name, allowing dry-run/TryAgainLater, or by ID)
  3. Check for earlier errors in the kops update log on the VPC creation step

Example fix

// before
vpc: {}  // neither id nor name
// after
vpc: {name: my-cluster-vpc}  // lets Find wait for the ID
Defensive patterns

Strategy: validation

Validate before calling

if vpc.ID == nil {
    if vpc.Name == nil {
        return errors.New("VPC reference needs either an ID or a name so it can be resolved")
    }
    // name set: kops will wait; otherwise resolve the ID first
}

Type guard

func vpcResolved(v *VPC) bool { return v != nil && (v.ID != nil || v.Name != nil) }

Try / catch

_, err := subnetTask.Find(c)
if err != nil && strings.Contains(err.Error(), "Subnet.VPC.ID is required") {
    // ensure the VPC task completes first, then retry the update
    return err
}

Prevention

When it happens

Trigger: v.VPC.ID == nil and v.VPC.Name == nil during Find(); the VPC reference was never resolved to an ID.

Common situations: Spec referencing a VPC only by an empty/missing identifier, or a broken dependency chain where the VPC task failed to populate its ID before the subnet task ran.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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