{"record":{"id":"bf29d8611d9ef56d","repo":"apache/cassandra","slug":"error-during-clearing-snapshots","errorCode":null,"errorMessage":"Error during clearing snapshots","messagePattern":"Error during clearing snapshots","errorType":"console","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/ClearSnapshot.java","lineNumber":129,"sourceCode":"\n        if (olderThanTimestamp != null)\n            sb.append(\" older than timestamp \").append(olderThanTimestamp);\n\n        probe.output().out.println(sb);\n\n        try\n        {\n            Map<String, Object> parameters = new HashMap<>();\n            if (olderThan != null)\n                parameters.put(\"older_than\", olderThan);\n            if (olderThanTimestamp != null)\n                parameters.put(\"older_than_timestamp\", olderThanTimestamp);\n\n            probe.clearSnapshot(parameters, snapshotName, toArray(keyspaces, String.class));\n        }\n        catch (IOException e)\n        {\n            throw new RuntimeException(\"Error during clearing snapshots\", e);\n        }\n    }\n}\n","sourceCodeStart":111,"sourceCodeEnd":133,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/ClearSnapshot.java#L111-L133","documentation":"Nodetool's ClearSnapshot wraps any IOException from the JMX call NodeProbe.clearSnapshot (which invokes StorageServiceMBean.takeSnapshot-style snapshot removal remotely) into a RuntimeException. It means the nodetool client could not communicate the clear-snapshots request to the node or the operation failed at the transport level. The snapshot data itself is not removed.","triggerScenarios":"Running `nodetool clearsnapshot` (with optional --before-timestamp, snapshot names, or keyspaces) when the JMX connection to the node breaks or the remote call throws IOException, e.g. node down mid-command or JMX auth/SSL failure.","commonSituations":"JMX port (default 7199) wrong or firewalled; Cassandra node stopped or crashed while clearing snapshots; JMX remote SSL/username-password misconfiguration; connecting to a node of a mismatched Cassandra version.","solutions":["Verify the node is up and JMX is reachable: `nodetool status` against the same host/port.","Check JMX connection settings (-p port, -u/-pw, SSL flags) in the nodetool command.","Inspect the wrapped cause (printed as 'Caused by') for the underlying IOException detail.","Retry after the node recovers; snapshot clearing is idempotent."],"exampleFix":"// before\nnodetool -h 10.0.0.5 clearsnapshot\n// after\nnodetool -h 10.0.0.5 -p 7199 -u jmxuser -pw jmxpass clearsnapshot  # correct port/creds","handlingStrategy":"try-catch","validationCode":"// check JMX reachability before clearing\ntry (JMXConnector c = JMXConnectorFactory.connect(new JMXServiceURL(\"service:jmx:rmi:///jndi/rmi://host:7199/jmxrmi\"))) {\n    c.getMBeanServerConnection().getDomains(); // probe connectivity\n}","typeGuard":null,"tryCatchPattern":"try { probe.clearSnapshot(params, name, keyspaces); }\ncatch (RuntimeException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof java.io.IOException) { /* node unreachable; alert + retry later */ }\n    else throw e;\n}","preventionTips":["Monitor JMX port availability before scripting snapshot cleanup.","Pin JMX credentials/SSL settings in nodetool config files.","Run clearsnapshot during stable cluster state, not during restarts.","Always read the 'Caused by' chain to distinguish connectivity from remote failure."],"tags":["nodetool","io","jmx","snapshots"],"backgroundTag":"jmx-connection-failed","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"}