{"record":{"id":"5c0f369cf1164348","repo":"apache/cassandra","slug":"unknown-endpoint-s-in-s-at-s","errorCode":null,"errorMessage":"Unknown endpoint %s in %s at %s","messagePattern":"Unknown endpoint (.+?) in (.+?) at (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tcm/ownership/ReplicaGroups.java","lineNumber":188,"sourceCode":"    public Delta difference(NodeIdLookup idLookup, ReplicaGroups next)\n    {\n        Multimap<NodeId, ReplicaNode> oldMap = this.byNodeId(idLookup);\n        Multimap<NodeId, ReplicaNode> newMap = next.byNodeId(idLookup);\n        return new NodeIdDelta(diff(oldMap, newMap), diff(newMap, oldMap));\n    }\n\n    private Multimap<NodeId, ReplicaNode> byNodeId(NodeIdLookup idLookup)\n    {\n        ImmutableMultimap.Builder<NodeId, ReplicaNode> builder = ImmutableMultimap.builder();\n        for (int i = 0; i < endpoints.size(); i++)\n        {\n            Map<InetAddressAndPort, Replica> replica = endpoints.get(i).byEndpoint();\n            for (Map.Entry<InetAddressAndPort, Replica> entry : replica.entrySet())\n            {\n                InetAddressAndPort endpoint = entry.getKey();\n                NodeId nodeId = idLookup.peerId(endpoint);\n                if (nodeId == null)\n                    throw new IllegalStateException(String.format(\"Unknown endpoint %s in %s at %s\", endpoint, idLookup, idLookup.lastModified()));\n                builder.put(nodeId, new ReplicaNode(nodeId, entry.getValue().range(), entry.getValue().isFull()));\n            }\n        }\n        return builder.build();\n    }\n\n    @VisibleForTesting\n    public RangesByEndpoint byEndpoint()\n    {\n        RangesByEndpoint.Builder builder = new RangesByEndpoint.Builder();\n        for (int i = 0; i < endpoints.size(); i++)\n            endpoints.get(i).byEndpoint().forEach(builder::put);\n        return builder.build();\n    }\n\n    private static ImmutableMultimap<NodeId, ReplicaNode> diff(Multimap<NodeId, ReplicaNode> left, Multimap<NodeId, ReplicaNode> right)\n    {\n        ImmutableMultimap.Builder<NodeId, ReplicaNode> builder = ImmutableMultimap.builder();","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/ownership/ReplicaGroups.java#L170-L206","documentation":"ReplicaGroups.byNodeId maps each endpoint of every range group to a NodeId via the supplied Directory.IdLookup. It throws IllegalStateException when an endpoint present in the placement data has no known NodeId in the directory, meaning placements reference an endpoint the directory does not know about.","triggerScenarios":"Calling byNodeId (used by oldMap/newMap during placement computations) while the cluster metadata directory lacks an entry for an endpoint that still appears in placement ranges — e.g. after a node was removed from the directory but its replicas remain in placements.","commonSituations":"Interrupted decommission leaves stale replicas in placement metadata; a join failed after range assignment but before directory registration was completed; metadata snapshot inconsistency between placements and directory epochs.","solutions":["Repair cluster metadata so placements and directory are consistent (recompute placements after the node is fully registered or removed)","Ensure the node's directory entry exists before running placement transformations referencing its endpoint","Roll back / reapply the in-progress metadata transformation (e.g. restart the CMS operation) so intermediate states are not persisted","Audit Directory vs PlacementDeltas for the failing endpoint and remove orphaned replicas"],"exampleFix":"// before\nNodeId nodeId = idLookup.peerId(endpoint);\n// after\nNodeId nodeId = idLookup.peerId(endpoint);\nif (nodeId == null)\n    logger.warn(\"Skipping unknown endpoint {} not present in directory\", endpoint);\nelse\n    builder.put(nodeId, new ReplicaNode(nodeId, ...));","handlingStrategy":"validation","validationCode":"for (InetAddressAndPort ep : endpointsInPlacements)\n    if (metadata.directory.peerId(ep) == null)\n        throw new IllegalStateException(\"endpoint missing from directory: \" + ep);","typeGuard":null,"tryCatchPattern":"try { Map<NodeId, ReplicaNode> m = replicaGroups.byNodeId(idLookup); } catch (IllegalStateException e) { /* rebuild placements from fresh metadata */ }","preventionTips":["Ensure directory registration completes before placement deltas referencing the node are computed","Avoid applying placement transforms against stale metadata epochs","Clean up orphaned replicas after failed joins/decommissions"],"tags":["tcm","directory","metadata-consistency","illegal-state"],"backgroundTag":"entity-not-found","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"}