kubernetes/kops · error
unsupported target type %q
Error message
unsupported target type %q
What it means
Run() selects an execution target from c.Target: "direct" (apply to the local node) or "dryrun" (write a dry-run manifest). Any other value hits the default branch and fails with "unsupported target type". Only these two literal strings are accepted for nodeup.
Source
Thrown at upup/pkg/fi/nodeup/command.go:374
taskMap[key] = &nodetasks.LoadImageTask{
Sources: image.Sources,
Hash: image.Hash,
}
}
var target fi.NodeupTarget
switch c.Target {
case "direct":
target = &local.LocalTarget{
CacheDir: c.CacheDir,
Cloud: cloud,
}
case "dryrun":
assetBuilder := assets.NewAssetBuilder(vfs.Context, nil, false)
target = fi.NewNodeupDryRunTarget(assetBuilder, out)
default:
return fmt.Errorf("unsupported target type %q", c.Target)
}
context, err := fi.NewNodeupContext(ctx, target, keyStore, &bootConfig, &nodeupConfig, taskMap)
if err != nil {
return fmt.Errorf("error building context: %w", err)
}
var options fi.RunTasksOptions
options.InitDefaults()
// Return rather than exit, so that the retry loop in cmd/nodeup gets to run:
// kops-configuration.service is Type=oneshot, so a bootstrap that exits here is never
// retried and the node never joins the cluster.
err = context.RunTasks(options)
if err != nil {
return fmt.Errorf("error running tasks: %w", err)
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Run nodeup with --target direct (real bootstrap) or --target dryrun (manifest only)
- Remove any kops-style target values (terraform/cloud) — those belong to `kops update cluster`, not nodeup
- Check wrapper scripts/env for an empty or mistyped TARGET variable
- Use the exact lowercase strings; "dry-run" is not accepted
Example fix
// before nodeup --target=terraform --config=/etc/kubernetes/nodeup.yaml // after nodeup --target=direct --config=/etc/kubernetes/nodeup.yaml
Defensive patterns
Strategy: validation
Validate before calling
switch target {
case "direct", "dryrun":
// ok
default:
return fmt.Errorf("target %q not supported by nodeup; use direct|dryrun", target)
} Type guard
func validNodeupTarget(t string) bool { return t == "direct" || t == "dryrun" } Try / catch
if err := nodeupCmd.Run(ctx); err != nil {
if strings.Contains(err.Error(), "unsupported target type") {
log.Fatalf("fix --target flag: %v", err)
}
return err
} Prevention
- Only pass --target direct or --target dryrun to nodeup
- Do not reuse `kops update cluster` target flags (terraform/cloud) for nodeup
- Quote/validate TARGET variables in bootstrap userdata
- Note the exact spelling: dryrun, not dry-run
When it happens
Trigger: nodeup is invoked with a --target (or NodeupCommand.Target) value other than "direct" or "dryrun", e.g. "node", "terraform", "cloud", or a typo like "dry-run".
Common situations: Copying --target flags from `kops update cluster` (which accepts terraform/cloud/dryrun) into nodeup; misspelling dryrun as dry-run; scripting nodeup with a variable left empty or set to a kops-style target name.
Related errors
- unable to parse argument %q as url
- too many arguments
- cannot mix --name for cluster with positional arguments
- unknown output format: %q
- must specify name of keyset promote keypair in
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/effd0efda563051a.
Report an issue: GitHub.