{"record":{"id":"7378de55ca303907","repo":"kubernetes/kops","slug":"invalid-value-q-for-instance-manager","errorCode":null,"errorMessage":"invalid value %q for --instance-manager","messagePattern":"invalid value %q for --instance-manager","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/new_cluster.go","lineNumber":487,"sourceCode":"\tswitch opt.InstanceManager {\n\tcase \"karpenter\":\n\t\tif opt.DiscoveryStore == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"karpenter requires --discovery-store\")\n\t\t}\n\t\tcluster.Spec.Karpenter = &api.KarpenterConfig{\n\t\t\tEnabled: true,\n\t\t}\n\t\tnodes, err = setupKarpenterNodes(opt)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase \"cloudgroups\":\n\t\tnodes, err = setupNodes(opt, cluster, zoneToSubnetsMap)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid value %q for --instance-manager\", opt.InstanceManager)\n\t}\n\n\tapiservers, err := setupAPIServers(opt, cluster, zoneToSubnetsMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = setupAPI(opt, cluster)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstanceGroups := append([]*api.InstanceGroup(nil), controlPlanes...)\n\tinstanceGroups = append(instanceGroups, apiservers...)\n\tinstanceGroups = append(instanceGroups, nodes...)\n\tinstanceGroups = append(instanceGroups, bastions...)\n\n\tfor _, instanceGroup := range instanceGroups {","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/new_cluster.go#L469-L505","documentation":"kops validates the --instance-manager flag during cluster creation. When the value supplied is not one of the supported instance managers (e.g. 'karpenter', 'cloudgroups'), NewCluster aborts with this message. It is a CLI/config input validation guard, not a runtime fault.","triggerScenarios":"Running `kops create cluster --instance-manager <bad-value>` where the value is misspelled, unsupported for the chosen cloud provider, or copied from docs for a different kops version.","commonSituations":"Typo like --instance-manager=karpentr; using a value enabled only behind a feature flag or on a specific cloud (e.g. karpenter on AWS only); following an outdated tutorial.","solutions":["Check supported values with `kops create cluster --help` and pass one exactly (e.g. --instance-manager=karpenter for AWS).","If the value is a feature-flagged manager, enable the required feature flag first: `export KOPS_FEATURE_FLAGS=<flag>` and retry.","Omit the flag entirely to use the default instance manager for the cloud provider.","Upgrade kops if the desired value only exists in a newer release."],"exampleFix":"// before\nkops create cluster --name=example.com --instance-manager=karpentr\n// after\nkops create cluster --name=example.com --instance-manager=karpenter","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"cloudgroups\": true, \"karpenter\": true}\nif em := flagInstanceManager; em != \"\" && !valid[em] {\n    return fmt.Errorf(\"unsupported --instance-manager %q; see 'kops create cluster --help'\", em)\n}","typeGuard":"func isValidInstanceManager(v string) bool {\n    switch v {\n    case \"cloudgroups\", \"karpenter\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"ig, err := NewCluster(opt, cluster, zoneToSubnetsMap)\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid value\") && strings.Contains(err.Error(), \"--instance-manager\") {\n        return fmt.Errorf(\"bad --instance-manager flag: %w (allowed: cloudgroups, karpenter)\", err)\n    }\n    return err\n}","preventionTips":["List allowed values with `kops create cluster --help` before passing the flag","Copy flag values from the docs matching your exact kops version","Script flag values via constants, not free-typed strings"],"tags":["cli","validation","configuration","kops"],"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-12T07:17:12.445Z"}