apache/cassandra · error · java.lang.IllegalArgumentException
arguments for -F are json,yaml only.
Error message
arguments for -F are json,yaml only.
What it means
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.
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.
Example fix
// before nodetool tpstats -F csv // after nodetool tpstats -F json
Defensive patterns
Strategy: validation
Validate before calling
if (!outputFormat.isEmpty() && !outputFormat.equals("json") && !outputFormat.equals("yaml"))
throw new IllegalArgumentException("-F must be json or yaml"); Try / catch
try { runNodetool("tpstats", "-F", fmt); }
catch (IllegalArgumentException e) { if (e.getMessage().contains("-F are json,yaml")) fmt = ""; else throw e; } Prevention
- 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.
When it happens
Trigger: `nodetool tpstats -F csv`, `-F XML`, or any format value other than json/yaml.
Common situations: Copy-pasting format flags from other tools; uppercase format names; expecting csv/tsv support that nodetool does not provide.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- arguments for -F are json,yaml only.
- arguments for -F are json,yaml only.
- argument for sort must be one of
- argument for top must be a positive integer.
- arguments for -F are json, yaml, table only.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/5fa5b27ba56a1861.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/tools/nodetool/TpStats.java:47
@Command(name = "tpstats", description = "Print usage statistics of thread pools")
public class TpStats extends AbstractCommand
{
@Option(paramLabel = "format",
names = { "-F", "--format" },
description = "Output format (json, yaml)")
private String outputFormat = "";
@Option(paramLabel = "verbose",
names = { "-v", "--verbose" },
description = "Display detailed metrics about thread pool's sizes")
private boolean verbose = false;
@Override
public void execute(NodeProbe probe)
{
if (!outputFormat.isEmpty() && !"json".equals(outputFormat) && !"yaml".equals(outputFormat))
{
throw new IllegalArgumentException("arguments for -F are json,yaml only.");
}
StatsHolder data = new TpStatsHolder(probe);
StatsPrinter printer = TpStatsPrinter.from(outputFormat);
printer.print(data, probe.output().out, verbose);
}
}
View on GitHub (pinned to 88fd0f6a0e)