{"record":{"id":"4acf758a6c32c0cb","repo":"kubernetes/kops","slug":"json-output-format-is-not-currently-supported-fo","errorCode":null,"errorMessage":"json output format is not (currently) supported for secrets","messagePattern":"json output format is not \\(currently\\) supported for secrets","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/get_secrets.go","lineNumber":147,"sourceCode":"\t\treturn err\n\t}\n\n\tif len(items) == 0 {\n\t\treturn fmt.Errorf(\"no secrets found\")\n\t}\n\tswitch options.Output {\n\n\tcase OutputTable:\n\t\tt := &tables.Table{}\n\t\tt.AddColumn(\"NAME\", func(i string) string {\n\t\t\treturn i\n\t\t})\n\t\treturn t.Render(items, out, \"NAME\")\n\n\tcase OutputYaml:\n\t\treturn fmt.Errorf(\"yaml output format is not (currently) supported for secrets\")\n\tcase OutputJSON:\n\t\treturn fmt.Errorf(\"json output format is not (currently) supported for secrets\")\n\tcase \"plaintext\":\n\t\tfor _, item := range items {\n\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","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/get_secrets.go#L129-L165","documentation":"RunGetSecrets has table and plaintext output paths, but the yaml and json branches intentionally return errors because the structured serializers are not implemented for secrets. This is the json branch: a known capability gap, not a data problem.","triggerScenarios":"Running `kops get secrets -o json` (or --output json).","commonSituations":"Scripts that pipe all `kops get` output through jq; users expecting parity with `kops get clusters -o json`.","solutions":["Use `-o plaintext` to dump secret values","Use the default table output","For programmatic access, use the kops Go clientset (f.KopsClient()) rather than parsing CLI output"],"exampleFix":"// before\nkops get secrets -o json | jq .\n\n// after\nkops get secrets -o plaintext","handlingStrategy":"validation","validationCode":"if [ \"$OUTPUT\" = \"json\" ]; then\n  echo \"json output not supported for secrets\"; OUTPUT=plaintext; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use plaintext output for machine parsing of secret values","Use the kops Go clientset for structured/JSON access instead of CLI output"],"tags":["cli","kops","unsupported-feature","output-format"],"backgroundTag":"unsupported-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"}