{"record":{"id":"6d6451ce64e02ec9","repo":"kubernetes/kops","slug":"kubernetes-feature-gate-must-include-a-feature-nam","errorCode":null,"errorMessage":"kubernetes feature gate must include a feature name","messagePattern":"kubernetes feature gate must include a feature name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":634,"sourceCode":"}\n\nfunc parseKubernetesFeatureGate(featureGate string) (string, bool, error) {\n\tfeatureGate = strings.TrimSpace(featureGate)\n\tif featureGate == \"\" {\n\t\treturn \"\", false, fmt.Errorf(\"kubernetes feature gate must not be empty\")\n\t}\n\n\tenabled := true\n\tswitch featureGate[0] {\n\tcase '+':\n\t\tfeatureGate = strings.TrimSpace(featureGate[1:])\n\tcase '-':\n\t\tenabled = false\n\t\tfeatureGate = strings.TrimSpace(featureGate[1:])\n\t}\n\n\tif featureGate == \"\" {\n\t\treturn \"\", false, fmt.Errorf(\"kubernetes feature gate must include a feature name\")\n\t}\n\n\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)","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L616-L652","documentation":"parseKubernetesFeatureGate returns this sentinel validation error when an entry consists only of a +/- sign with no feature name after it (e.g. '+,'). The sign was parsed but the remaining gate string is empty, so the entry is invalid.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/new_cluster.go:634 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a feature name after the +/- sign (e.g. +CSIMigration)","Fix scripts interpolating empty gate variables into the flag"],"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-12T07:17:12.445Z"}