{"record":{"id":"1f885ff75b9bda5d","repo":"kubernetes/kops","slug":"invalid-topology-s","errorCode":null,"errorMessage":"invalid topology %s","messagePattern":"invalid topology (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":1502,"sourceCode":"\t\t\t\t\tPublicName: \"bastion.\" + cluster.Name,\n\t\t\t\t}\n\t\t\t}\n\t\t\tif opt.IPv6 {\n\t\t\t\tfor _, s := range cluster.Spec.Networking.Subnets {\n\t\t\t\t\tif s.Type == api.SubnetTypeDualStack {\n\t\t\t\t\t\tbastionGroup.Spec.Subnets = append(bastionGroup.Spec.Subnets, s.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif cluster.GetCloudProvider() == api.CloudProviderGCE {\n\t\t\t\tbastionGroup.Spec.Zones = allZones.List()\n\t\t\t}\n\n\t\t\tbastionGroup.Spec.Image = opt.BastionImage\n\t\t}\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid topology %s\", opt.Topology)\n\t}\n\n\tif opt.IPv6 {\n\t\tcluster.Spec.Networking.NonMasqueradeCIDR = \"::/0\"\n\t\tcluster.Spec.ExternalCloudControllerManager = &api.CloudControllerManagerConfig{}\n\t\tif cluster.GetCloudProvider() == api.CloudProviderAWS {\n\t\t\tfor i := range cluster.Spec.Networking.Subnets {\n\t\t\t\tcluster.Spec.Networking.Subnets[i].IPv6CIDR = fmt.Sprintf(\"/64#%x\", i)\n\t\t\t}\n\t\t} else {\n\t\t\tklog.Errorf(\"IPv6 support is available only on AWS\")\n\t\t}\n\t}\n\n\treturn bastions, nil\n}\n\nfunc setupDNSTopology(opt *NewClusterOptions, cluster *api.Cluster) error {","sourceCodeStart":1484,"sourceCodeEnd":1520,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L1484-L1520","documentation":"After handling public and private topology, setupTopology's switch falls through to default when --topology is any other value. This is the guard against invalid topology strings, echoing the value the user passed.","triggerScenarios":"`kops create cluster --topology <invalid>` where <invalid> is anything other than \"public\" or \"private\" — e.g. a typo (`privte`), an empty value from a shell variable, or \"federated\" from a misunderstanding.","commonSituations":"Typos in scripts; unset shell variables expanding --topology \"\"; copying flags from other tools that support different topology names; case-sensitivity issues (Public vs public).","solutions":["Use exactly --topology public or --topology private.","Fix shell variables so the flag expands to a valid value, or drop the flag if the default is fine.","Check `kops create cluster --help` for accepted topology values."],"exampleFix":"// before\nkops create cluster my.cluster --topology $TOPOLOGY   # TOPOLOGY empty -> \"invalid topology \"\n// after\nTOPOLOGY=private kops create cluster my.cluster --topology $TOPOLOGY","handlingStrategy":"validation","validationCode":"case \"$TOPOLOGY\" in public|private) ;; *) echo \"--topology must be public or private\"; exit 1;; esac","typeGuard":null,"tryCatchPattern":"if err := createCluster(); err != nil && strings.Contains(err.Error(), \"invalid topology\") { /* print the value, fix it, retry */ }","preventionTips":["Whitelist topology values in wrapper scripts","Guard against unset variables defaulting the flag to empty","Use lowercase values only"],"tags":["topology","cli-flags","cluster-creation"],"backgroundTag":"invalid-flag-value","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"}