{"record":{"id":"de3929a0a1cfc69c","repo":"kubernetes/kops","slug":"subnet-id-not-set-de3929","errorCode":null,"errorMessage":"subnet ID not set","messagePattern":"subnet ID not set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/awstasks/routetableassociation.go","lineNumber":126,"sourceCode":"\t}\n\tif a != nil {\n\t\tif changes.RouteTable != nil {\n\t\t\treturn fi.CannotChangeField(\"RouteTable\")\n\t\t}\n\t\tif changes.Subnet != nil {\n\t\t\treturn fi.CannotChangeField(\"Subnet\")\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc findExistingRouteTableForSubnet(cloud awsup.AWSCloud, subnet *Subnet) (*ec2types.RouteTable, error) {\n\tctx := context.TODO()\n\tif subnet == nil {\n\t\treturn nil, fmt.Errorf(\"subnet not set\")\n\t}\n\tif subnet.ID == nil {\n\t\treturn nil, fmt.Errorf(\"subnet ID not set\")\n\t}\n\n\tsubnetID := fi.ValueOf(subnet.ID)\n\n\trequest := &ec2.DescribeRouteTablesInput{\n\t\tFilters: []ec2types.Filter{awsup.NewEC2Filter(\"association.subnet-id\", subnetID)},\n\t}\n\tresponse, err := cloud.EC2().DescribeRouteTables(ctx, request)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing RouteTables for subnet %q: %v\", subnetID, err)\n\t}\n\tif response == nil || len(response.RouteTables) == 0 {\n\t\treturn nil, nil\n\t}\n\n\tif len(response.RouteTables) != 1 {\n\t\treturn nil, fmt.Errorf(\"found multiple RouteTables attached to subnet\")\n\t}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/awstasks/routetableassociation.go#L108-L144","documentation":"findExistingRouteTableForSubnet refuses to look up a route table when the task's associated Subnet task has no ID, meaning the subnet has not yet been resolved to an AWS resource (not created or not found). kOps throws this to fail fast instead of making a DescribeRouteTables call with an empty subnet-id filter that would return bogus results.","triggerScenarios":"RenderAWS of a RouteTableAssociation whose e.Subnet is non-nil but e.Subnet.ID is nil — i.e., the Subnet task did not run/find first, subnet lookup failed silently upstream, or task ordering left the subnet unresolved.","commonSituations":"Reconciling an existing cluster where the referenced subnet was deleted out-of-band; misconfigured cluster spec referencing subnets that kOps never created; running kops update against a cluster with stale state store where Subnet task discovery failed.","solutions":["Verify the subnet actually exists in AWS and its ID is in the cluster spec (spec.subnets[*].id)","Run kops update with --v=2 to check whether the Subnet task found its ID before the association task","Re-run the update so the Subnet task completes before RouteTableAssociation; fix upstream failures in the Subnet find/create","If using shared subnets, ensure subnet IDs are set explicitly in the cluster spec"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before kops update\naws ec2 describe-subnets --subnet-ids <subnet-id>  # must exist and appear in cluster spec\nkops get cluster -o yaml | grep -A3 'subnets:'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set explicit subnet IDs when using shared subnets","Re-run kops update after any out-of-band subnet changes","Check kops toolbox dump / --v=2 to confirm Subnet tasks resolved IDs before associations"],"tags":["aws","subnet","route-table","task-resolution"],"backgroundTag":"subnet-id-not-resolved","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"}