{"record":{"id":"73245c3e55d2bd14","repo":"kubernetes/kops","slug":"failed-to-determine-vpc-id-of-subnet-s","errorCode":null,"errorMessage":"failed to determine VPC id of subnet %s","messagePattern":"failed to determine VPC id of subnet (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":655,"sourceCode":"\treturn featureGate, enabled, nil\n}\n\nfunc setupVPC(opt *NewClusterOptions, cluster *api.Cluster, cloud fi.Cloud) error {\n\tctx := context.TODO()\n\tcluster.Spec.Networking.NetworkID = opt.NetworkID\n\n\tswitch cluster.GetCloudProvider() {\n\tcase api.CloudProviderAWS:\n\t\tif cluster.Spec.Networking.NetworkID == \"\" && len(opt.SubnetIDs) > 0 {\n\t\t\tawsCloud := cloud.(awsup.AWSCloud)\n\t\t\tres, err := awsCloud.EC2().DescribeSubnets(ctx, &ec2.DescribeSubnetsInput{\n\t\t\t\tSubnetIds: []string{opt.SubnetIDs[0]},\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error describing subnet %s: %v\", opt.SubnetIDs[0], err)\n\t\t\t}\n\t\t\tif len(res.Subnets) == 0 || res.Subnets[0].VpcId == nil {\n\t\t\t\treturn fmt.Errorf(\"failed to determine VPC id of subnet %s\", opt.SubnetIDs[0])\n\t\t\t}\n\t\t\tcluster.Spec.Networking.NetworkID = *res.Subnets[0].VpcId\n\t\t}\n\n\t\tif featureflag.Spotinst.Enabled() {\n\t\t\tif opt.SpotinstProduct != \"\" {\n\t\t\t\tcluster.Spec.CloudProvider.AWS.SpotinstProduct = new(opt.SpotinstProduct)\n\t\t\t}\n\t\t\tif opt.SpotinstOrientation != \"\" {\n\t\t\t\tcluster.Spec.CloudProvider.AWS.SpotinstOrientation = new(opt.SpotinstOrientation)\n\t\t\t}\n\t\t}\n\n\tcase api.CloudProviderGCE:\n\t\tif cluster.Spec.CloudConfig == nil {\n\t\t\tcluster.Spec.CloudConfig = &api.CloudConfiguration{}\n\t\t}\n\t\tcluster.Spec.CloudProvider.GCE.Project = opt.Project","sourceCodeStart":637,"sourceCodeEnd":673,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L637-L673","documentation":"setupVPC (AWS branch) returns this guard when the described subnet has no VpcId set, so the cluster's network ID cannot be inferred from the given subnet. It fires on an unexpected/empty DescribeSubnets response rather than an API error.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/new_cluster.go:655 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the subnet ID resolves to a valid subnet in the region","Pass --networkid explicitly instead of inferring from the subnet"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}