{"record":{"id":"e2fa84a10d5b9225","repo":"kubernetes/kops","slug":"subnet-vpc-is-required","errorCode":null,"errorMessage":"Subnet.VPC is required","messagePattern":"Subnet\\.VPC is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/linodetasks/subnet.go","lineNumber":54,"sourceCode":"\tVPC  *VPC\n}\n\nvar _ fi.CloudupTask = &Subnet{}\nvar _ fi.CompareWithID = &Subnet{}\n\nfunc (v *Subnet) CompareWithID() *string {\n\tif v.ID == nil {\n\t\treturn nil\n\t}\n\tid := strconv.Itoa(fi.ValueOf(v.ID))\n\treturn new(id)\n}\n\nfunc (v *Subnet) Find(c *fi.CloudupContext) (*Subnet, error) {\n\tcloud := c.T.Cloud.(linode.LinodeCloud)\n\n\tif v.VPC == nil {\n\t\treturn nil, fmt.Errorf(\"Subnet.VPC is required\")\n\t}\n\tif v.VPC.ID == nil {\n\t\tif v.VPC.Name != nil {\n\t\t\tif _, ok := c.Target.(*fi.CloudupDryRunTarget); ok {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t\treturn nil, fi.NewTryAgainLaterError(\"waiting for VPC ID\")\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Subnet.VPC.ID is required\")\n\t}\n\n\tsubnets, err := cloud.Client().ListVPCSubnets(c.Context(), fi.ValueOf(v.VPC.ID), nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing Akamai (Linode) VPC Subnets: %w\", err)\n\t}\n\n\tvar foundByName *linodego.VPCSubnet\n\tvar foundByIPv4 *linodego.VPCSubnet","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/linodetasks/subnet.go#L36-L72","documentation":"Subnet.Find() requires the Subnet task to carry a reference to its parent VPC before it can query Linode for the actual subnet. A nil VPC reference means the desired state is incomplete, so it errors immediately.","triggerScenarios":"v.VPC == nil when Find() runs — the cluster spec/subnet task was built without linking the subnet to a VPC.","commonSituations":"Hand-edited cluster spec missing the VPC linkage, or a provisioning-order bug where the VPC task link was never populated.","solutions":["Ensure each subnet in the cluster spec references the cluster's VPC/network config","Re-generate the cluster spec from a valid template instead of hand-editing","Check that the networkID/VPC is defined in the cluster spec before subnets"],"exampleFix":"// before (spec)\nsubnets: [{name: subnet-1}]  // no vpc linkage\n// after\n// define network/vpc and reference it so Subnet.VPC is populated","handlingStrategy":"validation","validationCode":"if subnet.VPC == nil {\n    return errors.New(\"spec error: subnet must reference a VPC before find/create\")\n}","typeGuard":"func vpcLinked(s *Subnet) bool { return s != nil && s.VPC != nil }","tryCatchPattern":"sub, err := subnetTask.Find(c)\nif err != nil && err.Error() == \"Subnet.VPC is required\" {\n    // repair spec linkage to the VPC and re-run\n    return err\n}","preventionTips":["Always define the VPC/network section before subnets in the spec","Avoid hand-editing generated specs","Run kops update in dry-run first to catch linkage issues"],"tags":["linode","akamai","subnet","vpc","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}