{"record":{"id":"972437777fc599ba","repo":"apache/cassandra","slug":"host-id-not-found","errorCode":null,"errorMessage":"Host ID not found.","messagePattern":"Host ID not found\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tcm/sequences/SingleNodeSequences.java","lineNumber":134,"sourceCode":"    {\n        abortHelper(nodeId, MultiStepOperation.Kind.LEAVE, DECOMMISSION_FAILED);\n    }\n\n    /**\n     * Entrypoint to begin node removal process\n     *\n     * @param toRemove id of the node to remove\n     * @param force if set to true, will remove the node even if this would mean there will be not enough nodes\n     *              to satisfy replication factor\n     */\n    static void removeNode(NodeId toRemove, boolean force)\n    {\n        ClusterMetadata metadata = ClusterMetadata.current();\n        if (toRemove.equals(metadata.myNodeId()))\n            throw new UnsupportedOperationException(\"Cannot remove self\");\n        InetAddressAndPort endpoint = metadata.directory.endpoint(toRemove);\n        if (endpoint == null)\n            throw new UnsupportedOperationException(\"Host ID not found.\");\n        if (Gossiper.instance.getLiveMembers().contains(endpoint))\n            throw new UnsupportedOperationException(\"Node \" + endpoint + \" is alive and owns this ID. Use decommission command to remove it from the ring\");\n\n        NodeState removeState = metadata.directory.peerState(toRemove);\n        if (removeState == null)\n            throw new UnsupportedOperationException(\"Node to be removed is not a member of the token ring\");\n        if (removeState == NodeState.LEAVING)\n            logger.warn(\"Node {} is already leaving or being removed, continuing removal anyway\", endpoint);\n\n        if (metadata.inProgressSequences.contains(toRemove))\n            throw new UnsupportedOperationException(\"Can not remove a node that has an in-progress sequence\");\n\n        ReconfigureCMS.maybeReconfigureCMS(metadata, endpoint);\n\n        logger.info(\"starting removenode with {} {}\", metadata.epoch, toRemove);\n        Collection<Token> tokens  = metadata.tokenMap.tokens(toRemove);\n        ClusterMetadataService.instance().commit(new PrepareLeave(toRemove,\n                                                                  force,","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tcm/sequences/SingleNodeSequences.java#L116-L152","documentation":"removeNode looks up the endpoint for the given host ID in the cluster metadata directory; when no node with that NodeId exists, it throws UnsupportedOperationException(\"Host ID not found.\"). The cluster has no record of the supplied identifier.","triggerScenarios":"Calling `nodetool removenode <hostId>` with a host ID absent from ClusterMetadata.directory — typo, removed-already node, or an ID from a different cluster.","commonSituations":"Stale runbook references to a node that was already removed; mistyped or truncated UUID; copying a host ID from the wrong cluster in a multi-cluster environment; trailing whitespace/quotes in the argument.","solutions":["Run `nodetool status` on any live node and copy the exact Host ID of the target, then retry.","Confirm you are pointing at the right cluster/contact points.","If the node was already removed, no action is needed — the ID is simply gone.","Strip stray whitespace or quotes from the host ID argument."],"exampleFix":"// before\nnodetool removenode 8f3e-...  // stale id\n// after\nString hostId = getHostIdFromNodetoolStatus(deadNodeIp); // look up fresh\nnodetool.removenode(hostId);","handlingStrategy":"validation","validationCode":"String hostId = getTargetHostId();\nSet<String> known = storageService.getHostIdMap().keySet(); // live view of registered ids\nif (!known.contains(hostId))\n    throw new IllegalArgumentException(\"Host ID \" + hostId + \" not registered in this cluster\");","typeGuard":null,"tryCatchPattern":"try {\n    storageService.removeNode(hostId);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().equals(\"Host ID not found.\")) {\n        String fresh = lookupHostIdFromNodetoolStatus();\n        if (fresh != null) storageService.removeNode(fresh);\n    } else throw e;\n}","preventionTips":["Always copy host IDs from a fresh `nodetool status`, never from stale runbooks.","Validate UUID format and completeness before invoking removenode.","Confirm which cluster you are connected to in multi-cluster setups.","Treat 'Host ID not found' as a signal the node may already be removed."],"tags":["removenode","host-id","resource-not-found","operator-error"],"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-17T15:17:12.973Z"}