kubernetes/kops · error
unsupported target type %q
Error message
unsupported target type %q
What it means
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.
Source
Thrown at upup/pkg/fi/cloudup/apply_cluster.go:836
// Terraform tracks & performs deletions itself
deletionProcessingMode = fi.DeletionProcessingModeIgnore
case TargetDryRun:
var out io.Writer = os.Stdout
checkExisting := true
if c.GetAssets {
out = io.Discard
// For `kops get assets`,there is no need to run Find,
// we are just trying to discover the assets.
checkExisting = false
}
target = fi.NewCloudupDryRunTarget(assetBuilder, checkExisting, out)
// Avoid making changes on a dry-run
shouldPrecreateDNS = false
default:
return nil, fmt.Errorf("unsupported target type %q", c.TargetName)
}
c.Target = target
if target.DefaultCheckExisting() {
c.TaskMap, err = l.FindDeletions(cloud, c.LifecycleOverrides)
if err != nil {
return nil, fmt.Errorf("error finding deletions: %w", err)
}
}
context, err := fi.NewCloudupContext(ctx, deletionProcessingMode, target, cluster, cloud, keyStore, secretStore, configBase, c.TaskMap)
if err != nil {
return nil, fmt.Errorf("error building context: %v", err)
}
var options fi.RunTasksOptions
if c.RunTasksOptions != nil {
options = *c.RunTasksOptionsView on GitHub (pinned to 4c8573c808)
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
Example fix
// before kops update cluster mycluster.example.com --target=tf // after kops update cluster mycluster.example.com --target=terraform
Defensive patterns
Strategy: validation
Validate before calling
var validTargets = map[string]bool{"direct": true, "terraform": true, "dryrun": true}
if !validTargets[targetName] {
return fmt.Errorf("target %q not supported; use direct|terraform|dryrun", targetName)
} Type guard
func isKnownTarget(name string) bool {
switch name {
case "direct", "terraform", "dryrun":
return true
}
return false
} Prevention
- 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
When it happens
Trigger: Passing an unknown --target flag value to `kops update cluster` (or setting TargetName on ApplyClusterCmd programmatically) with a value other than: direct, terraform, dryrun.
Common situations: 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.
Related errors
- unsupported target type %q
- Error too many '=' (%d) in %s
- at least one channel URL is required
- building menu for %q: %w
- applying %q: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/2ee426900b019ade.
Report an issue: GitHub.