{"record":{"id":"516b45418ef2bd59","repo":"apache/cassandra","slug":"unknown-metric","errorCode":null,"errorMessage":"Unknown metric ","messagePattern":"Unknown metric ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/NodeProbe.java","lineNumber":2346,"sourceCode":"                        new ObjectName(\"org.apache.cassandra.metrics:type=CIDRGroupsMappingCache,name=\" + metricName),\n                        CassandraMetricsRegistry.JmxCounterMBean.class).getCount();\n                case CIDRAuthorizerMetrics.CIDR_GROUPS_CACHE_RELOAD_LATENCY:\n                case CIDRAuthorizerMetrics.LOOKUP_CIDR_GROUPS_FOR_IP_LATENCY:\n                    return JMX.newMBeanProxy(\n                        mbeanServerConn,\n                        new ObjectName(\"org.apache.cassandra.metrics:type=CIDRGroupsMappingCache,name=\" + metricName),\n                        CassandraMetricsRegistry.JmxTimerMBean.class).getMean();\n                default:\n                    if (metricName.contains(CIDRAuthorizerMetrics.CIDR_ACCESSES_REJECTED_COUNT_PREFIX) ||\n                        metricName.contains(CIDRAuthorizerMetrics.CIDR_ACCESSES_ACCEPTED_COUNT_PREFIX))\n                    {\n                        return JMX.newMBeanProxy(\n                            mbeanServerConn,\n                            new ObjectName(\"org.apache.cassandra.metrics:type=mymetricname,name=\" + metricName),\n                            CassandraMetricsRegistry.JmxCounterMBean.class).getCount();\n                    }\n\n                    throw new RuntimeException(\"Unknown metric \" + metricName);\n            }\n        }\n        catch (MalformedObjectNameException e)\n        {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public Map<String, Long> getCountsMetricsFromVtable()\n    {\n        return cfmProxy.getCountsMetricsFromVtable();\n    }\n\n    public Map<String, List<Double>> getLatenciesMetricsFromVtable()\n    {\n        return cfmProxy.getLatenciesMetricsFromVtable();\n    }\n","sourceCodeStart":2328,"sourceCodeEnd":2364,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/NodeProbe.java#L2328-L2364","documentation":"This generic metric lookup (the mymetricname special-case handler) only recognizes a fixed set of metric names; anything else reaches the fallback throw new RuntimeException(\"Unknown metric \" + metricName). It signals the caller asked for a metric this accessor does not support.","triggerScenarios":"Calling the generic per-type metric getter with a name not handled by any of its branches — the name may exist in JMX but is not mapped by this NodeProbe method.","commonSituations":"Users assuming the method is a generic pass-through to any Cassandra metric; metric renamed between versions; copying examples for a different accessor (table vs storage vs generic).","solutions":["Use one of the explicitly supported metric names for this method.","Call the type-specific accessor (getStorageMetric, getCompactionMetric, getTableMetric) that matches the metric's type instead.","Extend the method's switch to map the desired metric and rebuild the tools jar.","Inspect the JMX tree directly (e.g. via jconsole) to confirm the metric exists, then choose the right accessor."],"exampleFix":"// before\nprobe.getMetric(\"SomeUnmappedMetric\"); // unknown\n// after\nprobe.getStorageMetric(\"SomeUnmappedMetric\"); // use the matching accessor","handlingStrategy":"try-catch","validationCode":"if (!SUPPORTED_METRICS.contains(metricName))\n    throw new IllegalArgumentException(\"Metric not supported by this accessor: \" + metricName);","typeGuard":null,"tryCatchPattern":"try {\n    return probe.getMetric(metricName);\n} catch (RuntimeException e) {\n    if (String.valueOf(e.getMessage()).startsWith(\"Unknown metric\"))\n        throw new IllegalArgumentException(\"Unsupported metric \" + metricName + \"; use a type-specific accessor\", e);\n    throw e;\n}","preventionTips":["Do not assume the method is a generic pass-through to any metric","Match the metric's JMX type to the right NodeProbe accessor","Confirm the metric exists via jconsole/JMX dump before scripting","Extend the switch and rebuild the tools jar if you need new mappings"],"tags":["invalid-argument","metric-name","nodeprobe","unsupported-metric"],"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-17T15:17:12.973Z"}