{"record":{"id":"73a5128d6fddc165","repo":"apache/cassandra","slug":"unknown-node","errorCode":null,"errorMessage":"Unknown node ","messagePattern":"Unknown node ","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/RemoteToLocalVirtualTable.java","lineNumber":501,"sourceCode":"\n    private static void addExpressions(RowFilter rowFilter, List<ColumnMetadata> cms, int start, ByteBuffer[] values, Operator op, Operator lastOp)\n    {\n        for (int i = start ; i < values.length ; ++i)\n            rowFilter.add(cms.get(i), i + 1 == values.length ? lastOp : op, values[i]);\n    }\n\n    private static ClusteringIndexSliceFilter filter(TableMetadata metadata, ClusteringBound<?> start, ClusteringBound<?> end, boolean reversed)\n    {\n        return new ClusteringIndexSliceFilter(Slices.with(metadata.comparator, Slice.make(start, end)), reversed);\n    }\n\n    @Override\n    public void apply(PartitionUpdate update)\n    {\n        int nodeId = Int32Type.instance.compose(update.partitionKey().getKey());\n        InetAddressAndPort endpoint = ClusterMetadata.current().directory.endpoint(new NodeId(nodeId));\n        if (endpoint == null)\n            throw new InvalidRequestException(\"Unknown node \" + nodeId);\n\n        DeletionInfo deletionInfo = update.deletionInfo();\n        if (!deletionInfo.getPartitionDeletion().isLive())\n        {\n            truncate(endpoint).syncThrowUncheckedOnInterrupt();\n            return;\n        }\n\n        int pkCount = local.partitionKeyColumns().size();\n        ByteBuffer[] pkBuffer, ckBuffer;\n        {\n            int ckCount = local.clusteringColumns().size();\n            pkBuffer = pkCount == 1 ? null : new ByteBuffer[pkCount];\n            ckBuffer = new ByteBuffer[ckCount];\n        }\n\n        PartitionUpdate.Builder builder = null;\n        ArrayDeque<Promise<Void>> results = new ArrayDeque<>();","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/RemoteToLocalVirtualTable.java#L483-L519","documentation":"INSERT/UPDATE (apply) into the virtual table uses the partition key as a numeric NodeId. ClusterMetadata.directory has no endpoint registered for that id, so the write cannot be routed and InvalidRequestException is thrown.","triggerScenarios":"Writing to the virtual table with a partition key that is not a currently registered node id (typo, stale id of a removed node, wrong integer).","commonSituations":"Scripts caching node ids across cluster restarts; writes targeting a node after it was decommissioned/removenode'd; manual experimentation with arbitrary ids.","solutions":["Look up valid node ids (e.g. from the corresponding system virtual table or nodetool status) and use one of those as the partition key.","If targeting a restarted cluster, re-fetch node ids — ids are not stable across topology changes.","Verify the target node is still a member: ClusterMetadata.current().directory should contain it.","Correct the integer value; node ids are internal, not user-chosen."],"exampleFix":"// before\nINSERT INTO vt (node_id, ...) VALUES (42, ...);   // 42 not in cluster\n// after\nINSERT INTO vt (node_id, ...) VALUES (1, ...);    // id fetched from directory/status","handlingStrategy":"validation","validationCode":"int nodeId = ...;\nInetAddressAndPort ep = ClusterMetadata.current().directory.endpoint(new NodeId(nodeId));\nif (ep == null) throw new IllegalArgumentException(\"Unknown node \" + nodeId + \"; fetch valid ids from the directory\");","typeGuard":null,"tryCatchPattern":"try { session.execute(write); }\ncatch (InvalidRequestException e) {\n    if (e.getMessage().startsWith(\"Unknown node\"))\n        // refresh node id list and retry with a valid id\n}\n","preventionTips":["Fetch node ids dynamically, never hard-code them","Re-fetch ids after any topology change (decommission/bootstrap/restart)","Cross-check ids against nodetool status or the directory","Validate the id exists before issuing the write"],"tags":["cassandra","virtual-table","unknown-node","invalid-request"],"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"}