{"record":{"id":"4e28786536ff9821","repo":"MyCATApache/Mycat-Server","slug":"datanode-name-is-null","errorCode":null,"errorMessage":"dataNode name is null","messagePattern":"dataNode name is null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/config/model/TableConfig.java","lineNumber":73,"sourceCode":"    private final String parentKey;\n    private final String locateRTableKeySql;\n    // only has one level of parent\n    private final boolean secondLevel;\n    private final boolean partionKeyIsPrimaryKey;\n\n    private volatile List<SQLTableElement> tableElementList;\n    private volatile String tableStructureSQL;\n    private volatile Map<String, List<String>> dataNodeTableStructureSQLMap;\n    private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(false);\n\n    public TableConfig(String tableName, String primaryKey, boolean autoIncrement, boolean needAddLimit, int tableType,\n                       String dataNode, Set<String> dbType, RuleConfig rule, boolean ruleRequired,\n                       TableConfig parentTC, boolean isChildTable, String joinKey,\n                       String parentKey, String subTables, boolean fetchStoreNodeByJdbc) {\n        if (tableName == null) {\n            throw new IllegalArgumentException(\"table name is null\");\n        } else if (dataNode == null) {\n            throw new IllegalArgumentException(\"dataNode name is null\");\n        }\n        this.primaryKey = primaryKey;\n        this.autoIncrement = autoIncrement;\n        this.needAddLimit = needAddLimit;\n        this.fetchStoreNodeByJdbc = fetchStoreNodeByJdbc;\n        this.tableType = tableType;\n        this.dbTypes = dbType;\n        if (ruleRequired && rule == null) {\n            throw new IllegalArgumentException(\"ruleRequired but rule is null\");\n        }\n\n        this.name = tableName.toUpperCase();\n        String theDataNodes[] = SplitUtil.split(dataNode, ',', '$', '-');\n        if (theDataNodes == null || theDataNodes.length <= 0) {\n            throw new IllegalArgumentException(\"invalid table dataNodes: \" + dataNode);\n        }\n        dataNodes = new ArrayList<String>(theDataNodes.length);\n        for (String dn : theDataNodes) {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/model/TableConfig.java#L55-L91","documentation":"TableConfig's constructor requires a non-null dataNode; if the dataNode parameter is null it throws IllegalArgumentException(\"dataNode name is null\"). Every table must map to at least one data node so Mycat knows where to store and read its rows.","triggerScenarios":"Constructing TableConfig with dataNode == null, typically from a <table> element in schema.xml that has no dataNode attribute.","commonSituations":"Table entry in schema.xml missing dataNode=\"dn1\"; programmatically generated config omitting the data node; XML loader returning null for an empty attribute.","solutions":["Add dataNode=\"<existing-dataNode>\" to the <table> element in schema.xml.","Ensure the referenced dataNode is defined before the table config is built."],"exampleFix":"// before (schema.xml)\n<table name=\"orders\" primaryKey=\"id\" />\n// after\n<table name=\"orders\" primaryKey=\"id\" dataNode=\"dn1\" />","handlingStrategy":"validation","validationCode":"if (dataNode == null || dataNode.isEmpty()) throw new IllegalArgumentException(\"dataNode required for table \" + tableName);","typeGuard":null,"tryCatchPattern":"try { TableConfig tc = new TableConfig(...); } catch (IllegalArgumentException e) { if (\"dataNode name is null\".equals(e.getMessage())) { LOG.error(\"table {} missing dataNode\", tableName); } throw e; }","preventionTips":["Require dataNode on every <table> element in schema.xml.","Validate that referenced dataNodes exist in the dataNode definitions.","Add schema.xml checks to CI so missing attributes fail before deployment."],"tags":["config","mycat","null-argument","datanode"],"backgroundTag":"null-argument","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"}