{"record":{"id":"f35c2da244ce3df1","repo":"apache/cassandra","slug":"unknown-endpoint-s","errorCode":null,"errorMessage":"Unknown endpoint %s","messagePattern":"Unknown endpoint (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":452,"sourceCode":"    @Deprecated(since = \"CEP-21\")\n    public Collection<Range<Token>> getPrimaryRangesForEndpoint(String keyspace, InetAddressAndPort ep)\n    {\n        return TokenRingUtils.getPrimaryRangesForEndpoint(keyspace, ep);\n    }\n\n    @Deprecated(since = \"CEP-21\")\n    public Collection<Range<Token>> getPrimaryRangesWithinDC(String keyspace)\n    {\n        return getPrimaryRangeForEndpointWithinDC(keyspace, getBroadcastAddressAndPort());\n    }\n\n    @Deprecated(since = \"CEP-21\")\n    public Collection<Range<Token>> getLocalPrimaryRangeForEndpoint(InetAddressAndPort referenceEndpoint)\n    {\n        ClusterMetadata metadata = ClusterMetadata.current();\n        NodeId node = metadata.directory.peerId(referenceEndpoint);\n        if (node == null)\n            throw new IllegalArgumentException(\"Unknown endpoint \" + referenceEndpoint);\n        return SizeEstimatesRecorder.getLocalPrimaryRange(metadata, node);\n    }\n\n    @Deprecated(since = \"CEP-21\")\n    public Collection<Range<Token>> getPrimaryRangeForEndpointWithinDC(String keyspace, InetAddressAndPort endpoint)\n    {\n        return TokenRingUtils.getPrimaryRangeForEndpointWithinDC(keyspace, endpoint);\n    }\n\n    @Deprecated(since = \"CEP-21\")\n    public static List<Range<Token>> getAllRanges(List<Token> sortedTokens)\n    {\n        return TokenRingUtils.getAllRanges(sortedTokens);\n    }\n\n    private final Set<InetAddressAndPort> replicatingNodes = Sets.newConcurrentHashSet();\n    private CassandraDaemon daemon;\n","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L434-L470","documentation":"IllegalArgumentException from the deprecated (CEP-21) getLocalPrimaryRangeForEndpoint: the supplied endpoint address cannot be resolved to a peer NodeId in the current ClusterMetadata directory, meaning the node is unknown to the cluster (not part of membership).","triggerScenarios":"Calling StorageService.getLocalPrimaryRangeForEndpoint(InetAddressAndPort) via JMX/programmatic API with an address that is not a registered peer: wrong IP/port, decommissioned node, or a node not yet joined.","commonSituations":"Monitoring/estimation scripts hard-coding an old node IP after replacement; calling with the local address on a node whose identity registration changed after a CEP-21 (TCM) upgrade; typo in endpoint port.","solutions":["Verify the endpoint is a live cluster member: `nodetool status` and ClusterMetadata.directory peer list.","Update the caller to use the current node's address/port after replacement or decommission.","Use the TCM-native equivalent (SizeEstimatesRecorder.getLocalPrimaryRange with a NodeId from metadata.directory) instead of the deprecated method.","Handle null peerId before calling to avoid the throw."],"exampleFix":"// before\nCollection<Range<Token>> r = ss.getLocalPrimaryRangeForEndpoint(InetAddressAndPort.getByName(\"10.0.0.1\"));\n// after\nNodeId node = ClusterMetadata.current().directory.peerId(endpoint);\nif (node != null) {\n    Collection<Range<Token>> r = SizeEstimatesRecorder.getLocalPrimaryRange(ClusterMetadata.current(), node);\n}","handlingStrategy":"type-guard","validationCode":"NodeId node = ClusterMetadata.current().directory.peerId(endpoint);\nif (node == null) throw new IllegalArgumentException(\"Endpoint not a cluster member: \" + endpoint);","typeGuard":"boolean isKnownPeer(InetAddressAndPort ep) {\n    return ClusterMetadata.current().directory.peerId(ep) != null;\n}","tryCatchPattern":"catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unknown endpoint\")) {\n        refreshClusterMembership(); // reload ClusterMetadata / nodetool status\n        return;\n    }\n    throw e;\n}","preventionTips":["Resolve endpoints from current ClusterMetadata instead of hard-coded IPs.","Update monitoring scripts after node replacement/decommission.","Prefer the non-deprecated TCM-era API (SizeEstimatesRecorder with NodeId).","Check nodetool status membership before endpoint-based JMX calls."],"tags":["cassandra","jmx","tcm","endpoint-resolution","deprecated"],"backgroundTag":"resource-not-found","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"}