{"record":{"id":"effd0efda563051a","repo":"kubernetes/kops","slug":"unsupported-target-type-q-effd0e","errorCode":null,"errorMessage":"unsupported target type %q","messagePattern":"unsupported target type %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/nodeup/command.go","lineNumber":374,"sourceCode":"\t\ttaskMap[key] = &nodetasks.LoadImageTask{\n\t\t\tSources: image.Sources,\n\t\t\tHash:    image.Hash,\n\t\t}\n\t}\n\n\tvar target fi.NodeupTarget\n\n\tswitch c.Target {\n\tcase \"direct\":\n\t\ttarget = &local.LocalTarget{\n\t\t\tCacheDir: c.CacheDir,\n\t\t\tCloud:    cloud,\n\t\t}\n\tcase \"dryrun\":\n\t\tassetBuilder := assets.NewAssetBuilder(vfs.Context, nil, false)\n\t\ttarget = fi.NewNodeupDryRunTarget(assetBuilder, out)\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported target type %q\", c.Target)\n\t}\n\n\tcontext, err := fi.NewNodeupContext(ctx, target, keyStore, &bootConfig, &nodeupConfig, taskMap)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error building context: %w\", err)\n\t}\n\n\tvar options fi.RunTasksOptions\n\toptions.InitDefaults()\n\n\t// Return rather than exit, so that the retry loop in cmd/nodeup gets to run:\n\t// kops-configuration.service is Type=oneshot, so a bootstrap that exits here is never\n\t// retried and the node never joins the cluster.\n\terr = context.RunTasks(options)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error running tasks: %w\", err)\n\t}\n","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/nodeup/command.go#L356-L392","documentation":"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.","triggerScenarios":"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\".","commonSituations":"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.","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"],"exampleFix":"// before\nnodeup --target=terraform --config=/etc/kubernetes/nodeup.yaml\n// after\nnodeup --target=direct --config=/etc/kubernetes/nodeup.yaml","handlingStrategy":"validation","validationCode":"switch target {\ncase \"direct\", \"dryrun\":\n    // ok\ndefault:\n    return fmt.Errorf(\"target %q not supported by nodeup; use direct|dryrun\", target)\n}","typeGuard":"func validNodeupTarget(t string) bool { return t == \"direct\" || t == \"dryrun\" }","tryCatchPattern":"if err := nodeupCmd.Run(ctx); err != nil {\n    if strings.Contains(err.Error(), \"unsupported target type\") {\n        log.Fatalf(\"fix --target flag: %v\", err)\n    }\n    return err\n}","preventionTips":["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"],"tags":["nodeup","cli","target","argument-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"}