{"record":{"id":"2ee426900b019ade","repo":"kubernetes/kops","slug":"unsupported-target-type-q","errorCode":null,"errorMessage":"unsupported target type %q","messagePattern":"unsupported target type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/apply_cluster.go","lineNumber":836,"sourceCode":"\t\t// Terraform tracks & performs deletions itself\n\t\tdeletionProcessingMode = fi.DeletionProcessingModeIgnore\n\n\tcase TargetDryRun:\n\t\tvar out io.Writer = os.Stdout\n\t\tcheckExisting := true\n\t\tif c.GetAssets {\n\t\t\tout = io.Discard\n\t\t\t// For `kops get assets`,there is no need to run Find,\n\t\t\t// we are just trying to discover the assets.\n\t\t\tcheckExisting = false\n\t\t}\n\t\ttarget = fi.NewCloudupDryRunTarget(assetBuilder, checkExisting, out)\n\n\t\t// Avoid making changes on a dry-run\n\t\tshouldPrecreateDNS = false\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported target type %q\", c.TargetName)\n\t}\n\tc.Target = target\n\n\tif target.DefaultCheckExisting() {\n\t\tc.TaskMap, err = l.FindDeletions(cloud, c.LifecycleOverrides)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error finding deletions: %w\", err)\n\t\t}\n\t}\n\n\tcontext, err := fi.NewCloudupContext(ctx, deletionProcessingMode, target, cluster, cloud, keyStore, secretStore, configBase, c.TaskMap)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error building context: %v\", err)\n\t}\n\n\tvar options fi.RunTasksOptions\n\tif c.RunTasksOptions != nil {\n\t\toptions = *c.RunTasksOptions","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/apply_cluster.go#L818-L854","documentation":"ApplyClusterCmd.Run selects an apply target (direct API, terraform, dryrun) via a switch on c.TargetName; any unrecognized value hits the default branch and returns this error before any infrastructure work starts. It means the requested --target value is not one kops supports.","triggerScenarios":"Passing an unknown --target flag value to `kops update cluster` (or setting TargetName on ApplyClusterCmd programmatically) with a value other than: direct, terraform, dryrun.","commonSituations":"Typos like --target=terraformfile or --target=plan; copying examples from other tools (e.g. `--target=kubeadm`); custom tooling setting TargetName to a new value added in a newer kops release while running an older binary.","solutions":["Use one of the supported values: --target=direct, --target=terraform, or --target=dryrun","Check `kops update cluster --help` for the exact list of targets your kops version accepts","If you need a target added in a newer kops, upgrade the kops binary","When calling ApplyClusterCmd from Go, set c.TargetName to a defined constant (e.g. TargetTerraform, TargetDryRun) rather than a free-form string"],"exampleFix":"// before\nkops update cluster mycluster.example.com --target=tf\n// after\nkops update cluster mycluster.example.com --target=terraform","handlingStrategy":"validation","validationCode":"var validTargets = map[string]bool{\"direct\": true, \"terraform\": true, \"dryrun\": true}\nif !validTargets[targetName] {\n\treturn fmt.Errorf(\"target %q not supported; use direct|terraform|dryrun\", targetName)\n}","typeGuard":"func isKnownTarget(name string) bool {\n\tswitch name {\n\tcase \"direct\", \"terraform\", \"dryrun\":\n\t\treturn true\n\t}\n\treturn false\n}","tryCatchPattern":null,"preventionTips":["Only pass --target=direct, terraform, or dryrun","Check kops update cluster --help for targets supported by your binary version","When scripting, source target names from kops constants, not free-form strings","Upgrade kops before using targets introduced in newer releases"],"tags":["cli","target","config-validation"],"backgroundTag":"unsupported-target-type","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"}