{"record":{"id":"d3970031be1665f6","repo":"kubernetes/kops","slug":"unsupported-output-type-q","errorCode":null,"errorMessage":"unsupported output type %q","messagePattern":"unsupported output type %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/create_cluster.go","lineNumber":820,"sourceCode":"\t\t}\n\n\t\tfor _, o := range addons {\n\t\t\tobj = append(obj, o.ToUnstructured())\n\t\t}\n\n\t\tswitch c.Output {\n\t\tcase OutputYaml:\n\t\t\tif err := fullOutputYAML(out, obj...); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error writing cluster yaml to stdout: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\tcase OutputJSON:\n\t\t\tif err := fullOutputJSON(out, true, obj...); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error writing cluster json to stdout: %v\", err)\n\t\t\t}\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unsupported output type %q\", c.Output)\n\t\t}\n\t}\n\n\t// Note we perform as much validation as we can, before writing a bad config\n\terr = registry.CreateClusterConfig(ctx, clientset, cluster, instanceGroups, addons)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error writing updated configuration: %v\", err)\n\t}\n\n\tif len(c.SSHPublicKeys) == 0 {\n\t\tautoloadSSHPublicKeys := true\n\t\tswitch c.CloudProvider {\n\t\tcase \"gce\", \"aws\":\n\t\t\tautoloadSSHPublicKeys = false\n\t\t}\n\n\t\tif autoloadSSHPublicKeys {\n\t\t\t// Load from default locations, if found","sourceCodeStart":802,"sourceCodeEnd":838,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create_cluster.go#L802-L838","documentation":"In DryRun mode the switch over c.Output only accepts yaml and json; any other --output value falls into the default branch and returns this error immediately. It is a user input validation error, not a runtime failure.","triggerScenarios":"`kops create cluster --dry-run --output <something-other-than-yaml|json>`, e.g. --output yml, --output text, or --output Yaml (matching is case-sensitive).","commonSituations":"Typo (yml vs yaml); assuming other kops commands' output formats (e.g. table) apply here; passing an env-expanded empty string as --output.","solutions":["Use --output yaml or --output json exactly (lowercase).","Omit --dry-run if you want the default behavior instead of serialized output.","Check `kops create cluster --help` for supported output values."],"exampleFix":"// before\nkops create cluster ... --dry-run --output yml\n// after\nkops create cluster ... --dry-run --output yaml","handlingStrategy":"validation","validationCode":"output := strings.ToLower(c.Output)\nif output != \"yaml\" && output != \"json\" {\n\treturn fmt.Errorf(\"--output must be yaml or json, got %q\", c.Output)\n}","typeGuard":"func isValidOutputFormat(s string) bool {\n\treturn s == \"yaml\" || s == \"json\"\n}","tryCatchPattern":null,"preventionTips":["Only pass yaml or json (lowercase) to --output.","Grep scripts for --output flags and assert valid values in CI.","Never interpolate arbitrary env vars into --output without defaulting (e.g. ${OUTPUT:-yaml}).","Consult `kops create cluster --help` before scripting new formats."],"tags":["cli","dry-run","flag-validation"],"backgroundTag":"unsupported-flag-value","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}