{"record":{"id":"64b613d5cb89752d","repo":"kubernetes/kops","slug":"unknown-output-format-q-64b613","errorCode":null,"errorMessage":"unknown output format: %q","messagePattern":"unknown output format: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/get_secrets.go","lineNumber":168,"sourceCode":"\t\t\tvar data string\n\t\t\tsecret, err := secretStore.FindSecret(item)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"getting secret %q: %v\", item, err)\n\t\t\t}\n\t\t\tif secret == nil {\n\t\t\t\treturn fmt.Errorf(\"cannot find secret %q\", item)\n\t\t\t}\n\t\t\tdata = string(secret.Data)\n\n\t\t\t_, err = fmt.Fprintf(out, \"%s\\n\", data)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"writing output: %v\", err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown output format: %q\", options.Output)\n\t}\n}\n","sourceCodeStart":150,"sourceCodeEnd":171,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/get_secrets.go#L150-L171","documentation":"`kops get secrets` only supports a fixed set of --output values (table, text/yaml, json, depending on implementation). When options.Output holds any other string, the switch's default branch returns \"unknown output format: %q\". It is pure input validation of the -o/--output flag.","triggerScenarios":"Invoking `kops get secrets --output xml`, `--output yaml` when only table/json are accepted, or passing an empty/garbled value via scripts or wrappers that set the flag programmatically.","commonSituations":"Typos in the flag value; copying examples from other k8s tools with different output names; CI scripts parameterizing the output format with an unvalidated variable.","solutions":["Run `kops get secrets --help` and use exactly one of the supported values (table/text, json, yaml as listed)","Correct the flag, e.g. `-o json` instead of `-o xml`","Quote/validate the variable supplying --output in scripts before invoking kops"],"exampleFix":"// before\nkops get secrets mysecret -o xml\n// after\nkops get secrets mysecret -o json","handlingStrategy":"validation","validationCode":"case \"$OUT\" in\n  table|text|json|yaml) ;;\n  *) echo \"unsupported --output '$OUT'; use table, text, json, yaml\"; exit 1 ;;\nesac\nkops get secrets -o \"$OUT\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check `kops get secrets --help` for accepted --output values","Never interpolate unvalidated variables into -o/--output","Standardize on json or yaml for scripting"],"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-12T07:17:12.445Z"}