{"record":{"id":"5fa5b27ba56a1861","repo":"apache/cassandra","slug":"arguments-for-f-are-json-yaml-only-5fa5b2","errorCode":null,"errorMessage":"arguments for -F are json,yaml only.","messagePattern":"arguments for -F are json,yaml only\\.","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/TpStats.java","lineNumber":47,"sourceCode":"@Command(name = \"tpstats\", description = \"Print usage statistics of thread pools\")\npublic class TpStats extends AbstractCommand\n{\n    @Option(paramLabel = \"format\",\n            names = { \"-F\", \"--format\" },\n            description = \"Output format (json, yaml)\")\n    private String outputFormat = \"\";\n\n    @Option(paramLabel = \"verbose\",\n            names = { \"-v\", \"--verbose\" },\n            description = \"Display detailed metrics about thread pool's sizes\")\n    private boolean verbose = false;\n\n    @Override\n    public void execute(NodeProbe probe)\n    {\n        if (!outputFormat.isEmpty() && !\"json\".equals(outputFormat) && !\"yaml\".equals(outputFormat))\n        {\n            throw new IllegalArgumentException(\"arguments for -F are json,yaml only.\");\n        }\n\n        StatsHolder data = new TpStatsHolder(probe);\n        StatsPrinter printer = TpStatsPrinter.from(outputFormat);\n        printer.print(data, probe.output().out, verbose);\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":55,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/TpStats.java#L29-L55","documentation":"TpStats (thread-pool stats) accepts -F/--output-format restricted to exactly 'json' or 'yaml' (or empty for default output). Any other string throws IllegalArgumentException before stats are collected. Same allowlist pattern as TableStats.","triggerScenarios":"`nodetool tpstats -F csv`, `-F XML`, or any format value other than json/yaml.","commonSituations":"Copy-pasting format flags from other tools; uppercase format names; expecting csv/tsv support that nodetool does not provide.","solutions":["Use -F json or -F yaml exactly (lowercase).","Omit -F for the default table output.","Convert the JSON/YAML output downstream if another format is required."],"exampleFix":"// before\nnodetool tpstats -F csv\n// after\nnodetool tpstats -F json","handlingStrategy":"validation","validationCode":"if (!outputFormat.isEmpty() && !outputFormat.equals(\"json\") && !outputFormat.equals(\"yaml\"))\n    throw new IllegalArgumentException(\"-F must be json or yaml\");","typeGuard":null,"tryCatchPattern":"try { runNodetool(\"tpstats\", \"-F\", fmt); }\ncatch (IllegalArgumentException e) { if (e.getMessage().contains(\"-F are json,yaml\")) fmt = \"\"; else throw e; }","preventionTips":["Use lowercase format names only.","Standardize on JSON output for machine parsing across nodetool commands.","Verify supported flags with `nodetool help tpstats` on the target version."],"tags":["nodetool","cli","output-format"],"backgroundTag":"invalid-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}