{"record":{"id":"e835f6c2de9d94de","repo":"apache/cassandra","slug":"error-while-executing-truncate","errorCode":null,"errorMessage":"Error while executing truncate","messagePattern":"Error while executing truncate","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/NodeProbe.java","lineNumber":1267,"sourceCode":"    public String getOperationMode()\n    {\n        return ssProxy.getOperationMode();\n    }\n\n    public boolean isStarting()\n    {\n        return ssProxy.isStarting();\n    }\n\n    public void truncate(String keyspaceName, String tableName)\n    {\n        try\n        {\n            ssProxy.truncate(keyspaceName, tableName);\n        }\n        catch (TimeoutException e)\n        {\n            throw new RuntimeException(\"Error while executing truncate\", e);\n        }\n        catch (IOException e)\n        {\n            throw new RuntimeException(\"Error while executing truncate\", e);\n        }\n    }\n\n    public EndpointSnitchInfoMBean getEndpointSnitchInfoProxy()\n    {\n        try\n        {\n            return JMX.newMBeanProxy(mbeanServerConn, new ObjectName(\"org.apache.cassandra.db:type=EndpointSnitchInfo\"), EndpointSnitchInfoMBean.class);\n        }\n        catch (MalformedObjectNameException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }","sourceCodeStart":1249,"sourceCodeEnd":1285,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/NodeProbe.java#L1249-L1285","documentation":"NodeProbe.truncate delegates to StorageServiceMBean.truncate over JMX and wraps TimeoutException/IOException in a RuntimeException, meaning the truncate RPC to the node timed out or failed at the transport level — not that the data wasn't (eventually) truncated.","triggerScenarios":"nodetool truncate keyspace table when the server-side truncate exceeds the timeout or the connection breaks: very large table with slow snapshot/truncate across replicas, an overloaded or down node, or truncate_uncooperative / consistency issues.","commonSituations":"Truncating a huge table on a cluster with slow replicas; a node down or in bad state during truncate; gc_grace/lock contention causing truncate timeouts; JMX/network instability.","solutions":["Retry the truncate once the cluster is healthy","Check all target nodes are UP (nodetool status) and logs for truncate errors","Increase timeout via the truncate_rpc_timeout setting if large truncates regularly time out","Verify schema agreement and no pending repairs/migrations conflicting with the truncate"],"exampleFix":"// before\nnodetool truncate keyspace1 events   # node down\n// after\nnodetool status                       # ensure all UP\nnodetool truncate keyspace1 events","handlingStrategy":"retry","validationCode":"// Ensure all nodes are UP before truncating\n// nodetool status | grep -v '^UN' -> abort if any non-UN node","typeGuard":null,"tryCatchPattern":"try {\n    probe.truncate(keyspaceName, tableName);\n} catch (RuntimeException e) {\n    if (e.getMessage().equals(\"Error while executing truncate\") && attempts < 3) {\n        Thread.sleep(backoffMs);\n        retry();\n    } else throw e;\n}","preventionTips":["Check nodetool status shows all nodes UP before truncating","Increase truncate_rpc_timeout for very large tables","Avoid truncating during heavy load, repairs, or streaming","Check node logs for the underlying truncate failure"],"tags":["truncate","timeout","jmx"],"backgroundTag":"request-timeout","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"}