{"record":{"id":"2d4e5b62b099dfb3","repo":"apache/cassandra","slug":"error-message","errorCode":null,"errorMessage":"error: {message}","messagePattern":"error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/NodeTool.java","lineNumber":117,"sourceCode":"    {\n        try\n        {\n            CommandLine commandLine = createCommandLine(new CassandraCliFactory(nodeProbeFactory, output));\n            commandLine.setOut(new PrintWriter(output.out, true));\n            commandLine.setErr(new PrintWriter(output.err, true));\n\n            configureCliLayout(commandLine);\n            commandLine.setExecutionStrategy(JmxConnect::executionStrategy)\n                       .setExecutionExceptionHandler((ex, c, arg) -> {\n                           // Used for backward compatibility, some commands are validated when a command is run.\n                           if (ex instanceof IllegalArgumentException |\n                               ex instanceof IllegalStateException)\n                           {\n                               badUse(ex);\n                               return 1;\n                           }\n\n                           err(Throwables.getRootCause(ex));\n                           return 2;\n                       })\n                       .setParameterExceptionHandler((ex, arg) -> {\n                           badUse(ex);\n                           return 1;\n                       })\n                       // Some of the Cassandra commands don't comply with the POSIX standard, so we need to disable such options.\n                       // Example: ./nodetool -h localhost -p 7100 repair mykeyspayce -hosts 127.0.0.1,127.0.0.2\n                       //\n                       // This also means that option parameters must be separated from the option name by whitespace\n                       // or the = separator character, so -D key=value and -D=key=value will be recognized but\n                       // -Dkey=value will not.\n                       .setPosixClusteredShortOptionsAllowed(false);\n\n            printHistory(args);\n            return commandLine.execute(relocatePrintPortOptionsForBackwardCompatibility(args));\n        }\n        catch (ConfigurationException e)","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/NodeTool.java#L99-L135","documentation":"NodeTool's picocli command execution wraps arbitrary command exceptions: if the root cause is a parse/usage problem (ParameterException) or an IllegalStateException it reports bad use and exits 1; otherwise it prints the root cause via err() and exits 2. The user-visible 'error: {message}' comes from badUse/exception handling during nodetool command execution.","triggerScenarios":"Running any nodetool command whose execution throws — e.g. invalid arguments/options (picocli ParameterException), command invoked while the node is down or in a state making the operation illegal (IllegalStateException), or an underlying JMX/runtime exception surfaced as the root cause.","commonSituations":"Typo'd or missing command arguments; running nodetool against a node that hasn't finished startup; calling a command (e.g. decommission, rebuild) while the node is in a state that forbids it; node down / JMX connection failures.","solutions":["Check nodetool help <command> for correct syntax and rerun with valid arguments","Verify the node is up and JMX (port 7199) is reachable before running the command","Inspect the printed root-cause message and server logs (system.log) for the underlying exception","If IllegalStateException, ensure the node is in a valid state (e.g. NORMAL) for the requested operation"],"exampleFix":"// before\n$ nodetool scrub  // missing keyspace/table args -> error, exit 1\n// after\n$ nodetool help scrub\n$ nodetool scrub keyspace1 standard1","handlingStrategy":"try-catch","validationCode":"// validate arguments before invoking nodetool\nif (keyspace == null || tables == null || tables.length == 0)\n    throw new IllegalArgumentException(\"Usage: nodetool <command> <keyspace> <table>...\");\nboolean nodeUp = java.net.SocketTimeoutException.class.cast(null) == null\n    && tryProbeJmx(host, port); // e.g. open JMX connection and call isRunning first","typeGuard":null,"tryCatchPattern":"try {\n    int rc = nodeTool.execute(command, args);\n} catch ( picocli.ParameterException | IllegalStateException e) {\n    // bad use: fix syntax or node state, exit 1\n} catch (Exception e) {\n    Throwable root = org.apache.cassandra.utils.Throwables.getRootCause(e);\n    // inspect root.getMessage(); check system.log; exit 2\n}","preventionTips":["Run nodetool help <command> to confirm argument syntax before invoking","Ensure the node is fully started (nodetool status succeeds) before running state-sensitive commands","Check JMX connectivity (port 7199, auth settings) when commands fail remotely","Read the printed root-cause line and grep system.log for the same timestamp to find the underlying failure"],"tags":["nodetool","cli","jmx","command-line"],"backgroundTag":"invalid-cli-argument","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"}