{"record":{"id":"04cd9292923ba86d","repo":"apache/cassandra","slug":"unknown-cache-metric-name","errorCode":null,"errorMessage":"Unknown Cache metric name ","messagePattern":"Unknown Cache metric name ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/NodeProbe.java","lineNumber":1905,"sourceCode":"                    return JMX.newMBeanProxy(mbeanServerConn,\n                            new ObjectName(\"org.apache.cassandra.metrics:type=Cache,scope=\" + cacheType + \",name=\" + metricName),\n                            CassandraMetricsRegistry.JmxGaugeMBean.class).getValue();\n                case \"Requests\":\n                case \"Hits\":\n                case \"Misses\":\n                    return JMX.newMBeanProxy(mbeanServerConn,\n                            new ObjectName(\"org.apache.cassandra.metrics:type=Cache,scope=\" + cacheType + \",name=\" + metricName),\n                            CassandraMetricsRegistry.JmxMeterMBean.class).getCount();\n                case \"MissLatency\":\n                    return JMX.newMBeanProxy(mbeanServerConn,\n                            new ObjectName(\"org.apache.cassandra.metrics:type=Cache,scope=\" + cacheType + \",name=\" + metricName),\n                            CassandraMetricsRegistry.JmxTimerMBean.class).getMean();\n                case \"MissLatencyUnit\":\n                    return JMX.newMBeanProxy(mbeanServerConn,\n                            new ObjectName(\"org.apache.cassandra.metrics:type=Cache,scope=\" + cacheType + \",name=MissLatency\"),\n                            CassandraMetricsRegistry.JmxTimerMBean.class).getDurationUnit();\n                default:\n                    throw new RuntimeException(\"Unknown Cache metric name \" + metricName);\n\n            }\n        }\n        catch (MalformedObjectNameException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    /**\n     * Retrieve buffer pool metrics based on the buffer pool type\n     * @param poolType networking chunk-cache\n     * @param metricName UsedSize Size\n     * @return\n     */\n    public Object getBufferPoolMetric(String poolType, String metricName)\n    {\n        try","sourceCodeStart":1887,"sourceCodeEnd":1923,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/NodeProbe.java#L1887-L1923","documentation":"NodeProbe.getCacheMetric(String cacheType, String metricName) throws when the metricName argument is not one of the supported cache metric keys handled in the switch (e.g. Entries, Hits, Misses, Capacity, Size, HitRate, MissLatency, MissLatencyUnit). The metric name is a CLI-supplied string mapped to JMX MBean attributes, and unknown names cannot be resolved to an MBean proxy.","triggerScenarios":"Running `nodetool cachemetrics <cacheType> <badMetricName>` with a name outside the switch cases.","commonSituations":"Typo or case mismatch (e.g. 'hitrate' vs 'HitRate'); expecting metrics from other tool versions; guessing metric names instead of consulting `nodetool help cachemetrics`.","solutions":["Use a supported metric name exactly as spelled in the switch: e.g. Entries, Hits, Misses, Capacity, Size, HitRate, MissLatency, MissLatencyUnit","Check `nodetool help cachemetrics` for accepted names on your version","Inspect available Cache MBeans via JMX (org.apache.cassandra.metrics:type=Cache) to see valid attributes"],"exampleFix":"// before\nObject v = probe.getCacheMetric(\"KeyCache\", \"hitrate\");\n// after\nObject v = probe.getCacheMetric(\"KeyCache\", \"HitRate\");","handlingStrategy":"validation","validationCode":"java.util.Set<String> VALID = Set.of(\"Entries\",\"Size\",\"Capacity\",\"Hits\",\"Misses\",\"HitRate\",\"MissLatency\",\"MissLatencyUnit\");\nif (!VALID.contains(metricName)) throw new IllegalArgumentException(\"Unknown cache metric: \" + metricName);","typeGuard":null,"tryCatchPattern":"try { return probe.getCacheMetric(cacheType, metricName); } catch (RuntimeException e) { throw new IllegalArgumentException(\"Supported cache metrics: Entries, Size, Capacity, Hits, Misses, HitRate, MissLatency, MissLatencyUnit\", e); }","preventionTips":["Match metric names exactly including case","List supported names with nodetool help for your version","Cross-check with the Cache MBeans in JMX console"],"tags":["nodetool","cli-argument","jmx","metrics"],"backgroundTag":"invalid-enum-value","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"}