{"record":{"id":"e0ef90c431564081","repo":"MyCATApache/Mycat-Server","slug":"table-name-is-null","errorCode":null,"errorMessage":"table name is null","messagePattern":"table name is null","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/config/model/TableConfig.java","lineNumber":71,"sourceCode":"    private final boolean childTable;\n    private final String joinKey;\n    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        }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/model/TableConfig.java#L53-L89","documentation":"TableConfig's constructor requires a non-null tableName; it immediately throws IllegalArgumentException when tableName is null. The table name is fundamental — it is upper-cased and used as the routing key — so a null value is rejected at construction time.","triggerScenarios":"Calling new TableConfig(null, ...) directly, or the XML/config loader passing a null name because the <table> element lacks a name attribute.","commonSituations":"A <table> entry in schema.xml missing the name attribute; programmatic config generation where the name field is left unset; reflection-based config population skipping the name property.","solutions":["Set the name attribute on the <table> element in schema.xml.","If building TableConfig programmatically, pass a non-null table name string."],"exampleFix":"// before\nnew TableConfig(null, \"id\", ...);\n// after\nnew TableConfig(\" orders\", \"id\", ...); // non-null name, e.g. \"orders\"","handlingStrategy":"validation","validationCode":"if (tableName == null || tableName.isEmpty()) throw new IllegalArgumentException(\"table name required\");","typeGuard":"boolean hasName = (t != null && t.getTableName() != null && !t.getTableName().isEmpty());","tryCatchPattern":"try { TableConfig tc = new TableConfig(...); } catch (IllegalArgumentException e) { if (\"table name is null\".equals(e.getMessage())) { /* fix config entry */ } throw e; }","preventionTips":["Always give every <table> element a name attribute.","Validate table entries in schema.xml before startup.","When generating config programmatically, assert name != null before constructing TableConfig."],"tags":["config","mycat","null-argument","table"],"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"}