{"record":{"id":"17bd96410cb8a128","repo":"kubernetes/kops","slug":"unknown-output-format-q-17bd96","errorCode":null,"errorMessage":"unknown output format: %q","messagePattern":"unknown output format: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/get_sshpublickeys.go","lineNumber":137,"sourceCode":"\n\tcase OutputYaml:\n\t\ty, err := yaml.Marshal(items)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to marshal YAML: %v\", err)\n\t\t}\n\t\tif _, err := out.Write(y); err != nil {\n\t\t\treturn fmt.Errorf(\"error writing to output: %v\", err)\n\t\t}\n\tcase OutputJSON:\n\t\tj, err := json.Marshal(items)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to marshal JSON: %v\", err)\n\t\t}\n\t\tif _, err := out.Write(j); err != nil {\n\t\t\treturn fmt.Errorf(\"error writing to output: %v\", err)\n\t\t}\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown output format: %q\", options.Output)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":119,"sourceCodeEnd":142,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/get_sshpublickeys.go#L119-L142","documentation":"`kops get sshpublickeys` accepts only table, yaml, and json for --output. Any other value falls through the switch to the default branch, returning \"unknown output format: %q\" with the offending string. Pure flag validation.","triggerScenarios":"`kops get sshpublickeys -o csv`, `-o table` misspelled (e.g. `-o tabel`), or scripts interpolating an unvalidated format variable into --output.","commonSituations":"Typos in shell scripts; reusing flag values from other tools (e.g. `-o wide`); empty variable expansion leaving `-o \"\"`.","solutions":["Run `kops get sshpublickeys --help` and pick a supported value: table, yaml, or json","Fix the typo or interpolate the correct value in your script","Add a validation step in scripts: case \"$FMT\" in table|json|yaml) ;; *) exit 1;; esac"],"exampleFix":"// before\nkops get sshpublickeys -o $FORMAT   # FORMAT=\"csv\"\n// after\nFMT=json\nkops get sshpublickeys -o $FMT      # or validate FMT against table|json|yaml first","handlingStrategy":"validation","validationCode":"case \"$OUT\" in\n  table|json|yaml) ;;\n  *) echo \"invalid -o '$OUT' for sshpublickeys; expected table|json|yaml\"; exit 1 ;;\nesac\nkops get sshpublickeys -o \"$OUT\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enumerate valid formats in a shell variable/completion list","Validate format variables before interpolation","Prefer json/yaml for machine consumption"],"tags":["cli","validation","flags"],"backgroundTag":"unknown-output-format","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"}