{"record":{"id":"60b9530c660fb427","repo":"MyCATApache/Mycat-Server","slug":"can-t-find-valid-data-node-s-for-some-of-specifie","errorCode":null,"errorMessage":"Can't find valid data node(s) for some of specified node indexes :${tableConfig.getName()} -> ${tableConfig.getPartitionColumn()}","messagePattern":"Can't find valid data node\\(s\\) for some of specified node indexes :(.+?) -> (.+?)","errorType":"exception","errorClass":"java.sql.SQLNonTransientException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/util/RouterUtil.java","lineNumber":1722,"sourceCode":"\t\t\t\t\t\t\t\t\tif(algorithm instanceof SlotFunction){\r\n\t\t\t\t\t\t\t\t\t\trrs.getDataNodeSlotMap().put(node,((SlotFunction) algorithm).slotValue());\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\ttablesRouteMap.get(tableName).add(node);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tif(pair.rangeValue != null) {\r\n\t\t\t\t\t\t\t\tInteger[] nodeIndexs = algorithm\r\n\t\t\t\t\t\t\t\t\t\t.calculateRange(pair.rangeValue.beginValue.toString(), pair.rangeValue.endValue.toString());\r\n\t\t\t\t\t\t\t\tArrayList<String> dataNodes = tableConfig.getDataNodes();\r\n\t\t\t\t\t\t\t\tString node;\r\n\t\t\t\t\t\t\t\tfor(Integer idx : nodeIndexs) {\r\n\t\t\t\t\t\t\t\t\tif (idx >= 0 && idx < dataNodes.size()) {\r\n\t\t\t\t\t\t\t\t\t\tnode = dataNodes.get(idx);\r\n\t\t\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t\t\tString msg = \"Can't find valid data node(s) for some of specified node indexes :\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t+ tableConfig.getName() + \" -> \" + tableConfig.getPartitionColumn();\r\n\t\t\t\t\t\t\t\t\t\tLOGGER.warn(msg);\r\n\t\t\t\t\t\t\t\t\t\tthrow new SQLNonTransientException(msg);\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tif(node != null) {\r\n\t\t\t\t\t\t\t\t\t\tif(tablesRouteMap.get(tableName) == null) {\r\n\t\t\t\t\t\t\t\t\t\t\ttablesRouteMap.put(tableName, new HashSet<String>());\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\tif(algorithm instanceof SlotFunction){\r\n\t\t\t\t\t\t\t\t\t\t\trrs.getDataNodeSlotMap().put(node,((SlotFunction) algorithm).slotValue());\r\n\t\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\t\ttablesRouteMap.get(tableName).add(node);\r\n\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if(joinKey != null && columnsMap.get(joinKey) != null && columnsMap.get(joinKey).size() != 0) {//childTable  (如果是select 语句的父子表join)之前要找到root table,将childTable移除,只留下root table\r\n\t\t\t\t\tSet<ColumnRoutePair> joinKeyValue = columnsMap.get(joinKey);\r\n\r","sourceCodeStart":1704,"sourceCodeEnd":1740,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/util/RouterUtil.java#L1704-L1740","documentation":"Variant of the node-index routing failure used when the rule yields indexes for a set of values (e.g. IN clause): at least one computed index falls outside the table's configured dataNode range. Mycat cannot resolve every value to a data node, so the whole statement fails with SQLNonTransientException rather than routing partially.","triggerScenarios":"A query with IN (...) or multiple values on the partition column; RouterUtil's per-pair index loop finds idx < 0 || idx >= dataNodes.size() for any one value.","commonSituations":"Bulk queries with historical IDs written when more dataNodes existed; partition function bucket count changed; copy-pasted rule config from another schema with more nodes; typo in dataNode list in schema.xml.","solutions":["Compare each IN-list value's computed index against dataNodes.size(); add missing dataNodes to schema.xml or adjust the rule","Review recent changes to rule.xml/partition files and revert bucket counts to match the dataNode list","Split the query so values mapping to valid nodes are routed, and investigate out-of-range values separately","Ensure the partition algorithm cannot emit negative indexes (hash functions returning int can go negative)"],"exampleFix":"// before\nSELECT * FROM t_order WHERE user_id IN (1, 999999999); -- 999999999 -> idx out of range\n// after: shrink domain or add nodes\n<table name=\"t_order\" dataNode=\"dn1,dn2,...,dnN\" rule=\"sharding-by-murmur\" /> // N >= maxIndex+1","handlingStrategy":"validation","validationCode":"// Pre-check every IN-list value before sending the query\nfor (Object v : inValues) {\n    int idx = rule.calculate(v);\n    if (idx < 0 || idx >= nodeCount) throw new IllegalArgumentException(\"value out of sharding range: \" + v);\n}","typeGuard":null,"tryCatchPattern":"catch (SQLNonTransientException e) { if (e.getMessage().contains(\"valid data node(s)\")) { /* split query or fix config */ } else throw e; }","preventionTips":["Validate ID ranges in the application layer against current shard count","Never change dataNode count without a data migration plan","Log table + partition column + values on route failures for fast triage"],"tags":["sharding","routing","partition","datanode","in-clause"],"backgroundTag":"value-out-of-range","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}