{"record":{"id":"4bfd42f5f9e983c2","repo":"MyCATApache/Mycat-Server","slug":"datanode-node-is-not-found","errorCode":null,"errorMessage":"dataNode '${node}' is not found!","messagePattern":"dataNode '(.+?)' is not found!","errorType":"exception","errorClass":"ConfigException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/config/loader/xml/XMLSchemaLoader.java","lineNumber":564,"sourceCode":"                    getDbType(dataNodes), null, false, parentTable, true,\n                    joinKey, parentKey, subTables, false);\n\n            if (tables.containsKey(table.getName())) {\n                throw new ConfigException(\"table \" + table.getName() + \" duplicated!\");\n            }\n            tables.put(table.getName(), table);\n            //对于子表的子表，递归处理\n            processChildTables(tables, table, dataNodes, childTbElement);\n        }\n    }\n\n    private void checkDataNodeExists(Collection<String> nodes) {\n        if (nodes == null || nodes.size() < 1) {\n            return;\n        }\n        for (String node : nodes) {\n            if (!dataNodes.containsKey(node)) {\n                throw new ConfigException(\"dataNode '\" + node + \"' is not found!\");\n            }\n        }\n    }\n\n    /**\n     * 检查分片表分片规则配置, 目前主要检查分片表分片算法定义与分片dataNode是否匹配<br>\n     * 例如分片表定义如下:<br>\n     * {@code\n     * <table name=\"hotnews\" primaryKey=\"ID\" autoIncrement=\"true\" dataNode=\"dn1,dn2\"\n     * rule=\"mod-long\" />\n     * }\n     * <br>\n     * 分片算法如下:<br>\n     * {@code\n     * <function name=\"mod-long\" class=\"io.mycat.route.function.PartitionByMod\">\n     * <!-- how many data nodes -->\n     * <property name=\"count\">3</property>\n     * </function>","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/loader/xml/XMLSchemaLoader.java#L546-L582","documentation":"Thrown by XMLSchemaLoader.checkDataNodeExists when a table or child table references a dataNode name that was never defined as a <dataNode> element. Mycat validates every referenced node exists in the dataNodes map before schema loading completes.","triggerScenarios":"A <table name=\"t\" dataNode=\"dn9\"> where dn9 is not defined by any <dataNode name=\"dn9\">; also invoked for distributed dataNode lists expanded from distribute() syntax or child-table dataNodes.","commonSituations":"Typo in a table's dataNode attribute; dataNode removed from schema.xml but tables still reference it; range-expanded names like dn1$0-75 not covering the referenced index.","solutions":["Add the missing <dataNode name=\"...\" dataHost=\"...\" database=\"...\"> definition to schema.xml","Fix the dataNode attribute spelling on the offending <table> element","List all defined dataNodes and cross-check every table reference"],"exampleFix":"// before (schema.xml)\n<table name=\"t\" dataNode=\"dn2\" /> <!-- dn2 undefined -->\n// after\n<dataNode name=\"dn2\" dataHost=\"localhost1\" database=\"db2\" />\n<table name=\"t\" dataNode=\"dn2\" />","handlingStrategy":"validation","validationCode":"// verify all dataNode references on tables exist before load\nSet<String> defined = collectDataNodeNames(\"schema.xml\");\nfor (Element t : schemaTables(\"schema.xml\")) {\n    for (String dn : t.getAttribute(\"dataNode\").replaceAll(\"distribute\\\\(|\\\\)\", \"\").split(\"[,$-]\")) {\n        if (!defined.contains(dn.trim()))\n            throw new IllegalStateException(\"Unknown dataNode: \" + dn);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    configLoader.load();\n} catch (ConfigException e) {\n    if (e.getMessage().contains(\"dataNode\") && e.getMessage().contains(\"is not found\")) {\n        String node = extractQuoted(e.getMessage());\n        log.error(\"Define <dataNode name='\" + node + \"'> or fix the table reference\", e);\n    }\n    throw e;\n}","preventionTips":["Cross-check every table's dataNode attribute against declared <dataNode> names after edits","When shrinking dn ranges (dn1$0-75), update all tables referencing removed nodes","Keep dataNode declarations and references in the same config review"],"tags":["config","xml","missing-reference","datanode"],"backgroundTag":"resource-not-found","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"}