{"record":{"id":"de98f0b340559649","repo":"apache/cassandra","slug":"can-t-delete-hints-for-unknown-address","errorCode":null,"errorMessage":"Can't delete hints for unknown address ","messagePattern":"Can't delete hints for unknown address ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/hints/HintsService.java","lineNumber":415,"sourceCode":"            target = InetAddressAndPort.getByName(address);\n        }\n        catch (UnknownHostException e)\n        {\n            throw new IllegalArgumentException(e);\n        }\n        deleteAllHintsForEndpoint(target);\n    }\n\n    /**\n     * Deletes all hints for the provided destination. Doesn't make snapshots - should be used with care.\n     *\n     * @param target inet address of the target node\n     */\n    public void deleteAllHintsForEndpoint(InetAddressAndPort target)\n    {\n        UUID hostId = StorageService.instance.getHostIdForEndpoint(target);\n        if (hostId == null)\n            throw new IllegalArgumentException(\"Can't delete hints for unknown address \" + target);\n        catalog.deleteAllHints(hostId);\n    }\n\n    /**\n     * Cleans up hints-related state after a node with id = hostId left.\n     *\n     * Dispatcher can not stop itself (isHostAlive() can not start returning false for the leaving host because this\n     * method is called by the same thread as gossip, which blocks gossip), so we can't simply wait for\n     * completion.\n     *\n     * We should also flush the buffer if there are any hints for the node there, and close the writer (if any),\n     * so that we don't leave any hint files lying around.\n     *\n     * Once that is done, we can simply delete all hint files and remove the host id from the catalog.\n     *\n     * The worst that can happen if we don't get everything right is a hints file (or two) remaining undeleted.\n     *\n     * @param hostId id of the node being excised","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/hints/HintsService.java#L397-L433","documentation":"IllegalArgumentException thrown by HintsService.deleteAllHintsForEndpoint when the given target address is unknown to the node — StorageService.getHostIdForEndpoint returns null because no host id is mapped to that endpoint.","triggerScenarios":"Calling deleteAllHintsForEndpoint(InetAddressAndPort) with an address that is not in gossip (no hostId mapping): typo'd IP, decommissioned node still in hints but gone from gossip, or called before gossip convergence.","commonSituations":"Ops scripts cleaning hints for a node that was already removed; nodetool delifthints (deletehints-for-endpoint path) with a stale or mistyped address; calling during node startup before peer host ids are loaded.","solutions":["Verify the address with `nodetool status` / system.peers before deleting","Use the node's hostId with deleteHintsForHostId instead of the address form","If the node was decommissioned, its hints were already removed — nothing to delete","Wait for gossip to settle after node restart before issuing the call"],"exampleFix":"// before\nHintsService.instance.deleteAllHintsForEndpoint(addr);\n// after\nUUID hostId = StorageService.instance.getHostIdForEndpoint(addr);\nif (hostId != null)\n    HintsService.instance.deleteAllHintsForEndpoint(addr);\nelse\n    logger.warn(\"No host id for {}; skipping hints deletion\", addr);","handlingStrategy":"validation","validationCode":"UUID hostId = StorageService.instance.getHostIdForEndpoint(target);\nif (hostId == null) {\n    logger.warn(\"Unknown endpoint {} for hints deletion; check nodetool status\", target);\n    return;\n}\nHintsService.instance.deleteAllHintsForEndpoint(target);","typeGuard":"boolean isKnownEndpoint(InetAddressAndPort a) {\n    return StorageService.instance.getHostIdForEndpoint(a) != null;\n}","tryCatchPattern":"try {\n    HintsService.instance.deleteAllHintsForEndpoint(target);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"Endpoint unknown; skipping hints deletion: {}\", e.getMessage());\n}","preventionTips":["Confirm the address via `nodetool status`/system.peers first","Prefer hostId-based deletion over address-based","Wait for gossip convergence after node restart before cleanup","Clean up hints when the node leaves the ring (decommission does this automatically)"],"tags":["hints","validation","gossip","argument"],"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"}