{"record":{"id":"7190c8d8e7797bcb","repo":"apache/cassandra","slug":"error-message-7190c8","errorCode":null,"errorMessage":"error: {message}","messagePattern":"error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/OfflineClusterMetadataDump.java","lineNumber":107,"sourceCode":" *\n * # Dump distributed log (CMS nodes)\n * offlineclustermetadatadump distributed-log --data-dir /path/to/data\n * </pre>\n */\n@Command(name = \"offlineclustermetadatadump\",\nmixinStandardHelpOptions = true,\ndescription = \"Offline tool to dump cluster metadata from local SSTables. NOTE: For offline use only.\",\nsubcommands = { OfflineClusterMetadataDump.MetadataCommand.class, OfflineClusterMetadataDump.LogCommand.class, OfflineClusterMetadataDump.DistributedLogCommand.class })\npublic class OfflineClusterMetadataDump implements Runnable\n{\n    private static final Output output = Output.CONSOLE;\n\n    public static void main(String... args)\n    {\n        Util.initDatabaseDescriptor();\n\n        CommandLine cli = new CommandLine(OfflineClusterMetadataDump.class).setExecutionExceptionHandler((ex, cmd, parseResult) -> {\n            err(ex);\n            return 2;\n        });\n        int status = cli.execute(args);\n        System.exit(status);\n    }\n\n    protected static void err(Throwable e)\n    {\n        output.err.println(\"error: \" + e.getMessage());\n        output.err.println(\"-- StackTrace --\");\n        output.err.println(getStackTraceAsString(e));\n    }\n\n    @Override\n    public void run()\n    {\n        CommandLine.usage(this, output.out);\n    }","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/OfflineClusterMetadataDump.java#L89-L125","documentation":"OfflineClusterMetadataDump.main registers picocli's execution exception handler that calls err(ex), printing 'error: <message>' plus the stack trace to stderr and returning exit code 2. Any exception thrown while executing the offline metadata dump command surfaces through this handler.","triggerScenarios":"cli.execute(args) runs the dump command and an exception occurs: unreadable or corrupt metadata files (hoststats/metadata dump paths), invalid command-line options causing execution failure, or Schema/DatabaseDescriptor initialization problems.","commonSituations":"Running the dump against SSTables/metadata from a mismatched Cassandra version; missing or unreadable data/hints directories; running without the required environment (JAVA_HOME, cassandra config) so Util.initDatabaseDescriptor fails.","solutions":["Inspect the '-- StackTrace --' section printed after the error line to find the root cause","Verify the target directories/files exist and belong to the same Cassandra version","Run with correct arguments: check 'offlinectools' usage for the dump subcommand's required options","Ensure Util.initDatabaseDescriptor() prerequisites are met (cassandra.yaml readable, config valid)"],"exampleFix":"// before\nOfflineClusterMetadataDump dumpMainArgs = new OfflineClusterMetadataDump(Paths.get(\"/wrong/path\"));\n// after\nPath p = Paths.get(\"/var/lib/cassandra/data\");\nif (!Files.isDirectory(p)) throw new IllegalArgumentException(\"not a directory: \" + p);\nOfflineClusterMetadataDump dumpMainArgs = new OfflineClusterMetadataDump(p);","handlingStrategy":"validation","validationCode":"// validate inputs before invoking the offline dump\nPath dir = Paths.get(dataDir);\nif (!Files.isDirectory(dir))\n    throw new IllegalArgumentException(\"data directory does not exist: \" + dir);\nif (!Files.isReadable(dir))\n    throw new IllegalArgumentException(\"data directory not readable: \" + dir);","typeGuard":null,"tryCatchPattern":"try {\n    int status = cli.execute(args);\n    System.exit(status);\n} catch (Throwable t) {\n    t.printStackTrace();\n    System.exit(2);\n}","preventionTips":["Run the tool on a node of the same Cassandra version that produced the data","Snapshot/verify data directories before offline processing","Ensure cassandra.yaml and JAVA_HOME are valid in the tooling environment"],"tags":["offline-tools","cli","picocli","metadata-dump"],"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-14T16:17:12.679Z"}