apache/cassandra · error · RuntimeException

Could not retrieve list of stat mbeans.

Error message

Could not retrieve list of stat mbeans.

What it means

When listing ColumnFamilyStore MBeans fails with IOException — e.g. the JMX connection to the node broke mid-query — NodeProbe wraps it in this RuntimeException indicating the list of stat mbeans could not be retrieved.

Source

Thrown at src/java/org/apache/cassandra/tools/NodeProbe.java:871

    public double[] getAndResetGCStats()
    {
        return gcProxy.getAndResetStats();
    }

    public Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> getColumnFamilyStoreMBeanProxies()
    {
        try
        {
            return new ColumnFamilyStoreMBeanIterator(mbeanServerConn);
        }
        catch (MalformedObjectNameException e)
        {
            throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e);
        }
        catch (IOException e)
        {
            throw new RuntimeException("Could not retrieve list of stat mbeans.", e);
        }
    }

    public CompactionManagerMBean getCompactionManagerProxy()
    {
      return compactionProxy;
    }

    public List<String> getTokens()
    {
        return ssProxy.getTokens();
    }

    public List<String> getTokens(String endpoint)
    {
        try
        {
            return ssProxy.getTokens(endpoint);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Re-run the nodetool command
  2. Verify the node is up and JMX is reachable (check JMX_PORT, firewall, jmxremote options)
  3. Reconnect with fresh credentials/connection (restart nodetool)
  4. Check node logs for GC pauses or restarts that dropped the JMX session

Example fix

// before
nodetool tablestats   # node restarting mid-call
// after
nodetool status && nodetool tablestats
Defensive patterns

Strategy: retry

Validate before calling

// Verify JMX reachability first
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://host:" + port + "/jmxrmi");
try (JMXConnector c = JMXConnectorFactory.connect(url, env)) { /* ok */ }

Try / catch

try {
    probe.getColumnFamilyStoreMBeanProxies();
} catch (RuntimeException e) {
    if (e.getMessage().contains("Could not retrieve list of stat mbeans")) {
        Thread.sleep(backoffMs);
        probe.getColumnFamilyStoreMBeanProxies(); // retry
    } else throw e;
}

Prevention

When it happens

Trigger: Calling methods that enumerate table stats (tablestats, cfstats paths) when mbeanServerConn.queryNames/connection fails with IOException: JMX connection dropped, remote node restarted, or RMI/network failure mid-call.

Common situations: Node restarted while nodetool was running; network partition between client and node; JMX port/firewall issues; SSL/RMI handshake failure on long-running connections.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/f3cdc8b05b5b6002. Report an issue: GitHub.