{"record":{"id":"bc16788997c0e02d","repo":"MyCATApache/Mycat-Server","slug":"table-name-is-not-found","errorCode":null,"errorMessage":"table name is not found!","messagePattern":"table name is not found!","errorType":"exception","errorClass":"ConfigException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/config/loader/xml/XMLSchemaLoader.java","lineNumber":378,"sourceCode":"            //记录dataNode，就是分布在哪些dataNode上\n            String dataNode = tableElement.getAttribute(\"dataNode\");\n            TableRuleConfig tableRule = null;\n            if (tableElement.hasAttribute(\"rule\")) {\n                String ruleName = tableElement.getAttribute(\"rule\");\n                tableRule = tableRules.get(ruleName);\n                if (tableRule == null) {\n                    throw new ConfigException(\"rule \" + ruleName + \" is not found!\");\n                }\n            }\n\n            boolean ruleRequired = false;\n            //记录是否绑定有分片规则\n            if (tableElement.hasAttribute(\"ruleRequired\")) {\n                ruleRequired = Boolean.parseBoolean(tableElement.getAttribute(\"ruleRequired\"));\n            }\n\n            if (tableNames == null) {\n                throw new ConfigException(\"table name is not found!\");\n            }\n            //distribute函数，重新编排dataNode\n            String distPrex = \"distribute(\";\n            boolean distTableDns = dataNode.startsWith(distPrex);\n            if (distTableDns) {\n                dataNode = dataNode.substring(distPrex.length(), dataNode.length() - 1);\n            }\n            //分表功能\n            String subTables = tableElement.getAttribute(\"subTables\");\n\n            for (int j = 0; j < tableNames.length; j++) {\n\n                String tableName = tableNames[j];\n                TableRuleConfig tableRuleConfig = tableRule;\n                if (tableRuleConfig != null) {\n                    //对于实现TableRuleAware的function进行特殊处理  根据每个表新建个实例\n                    RuleConfig rule = tableRuleConfig.getRule();\n                    if (rule.getRuleAlgorithm() instanceof TableRuleAware) {","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/loader/xml/XMLSchemaLoader.java#L360-L396","documentation":"Thrown by XMLSchemaLoader.loadTable when a <table> element in schema.xml has no 'name' attribute (tableNames parsed to null/empty). Mycat cannot register a table without a name, so schema loading fails fast with ConfigException.","triggerScenarios":"A <table dataNode=\"dn1\" ...> element missing the name attribute entirely, or name=\"\" empty in schema.xml, reached via loadTables from the schema loader.","commonSituations":"Hand-edited schema.xml where the name attribute was accidentally deleted; XML minification tools dropping attributes; generated configs with empty placeholders.","solutions":["Add a non-empty name attribute to the offending <table> element in schema.xml","Validate schema.xml structure (every table needs name, dataNode, and optionally rule)","If multiple names, use comma-separated names in the name attribute"],"exampleFix":"// before (schema.xml)\n<table dataNode=\"dn1\" rule=\"rule1\" />\n// after\n<table name=\"orders\" dataNode=\"dn1\" rule=\"rule1\" />","handlingStrategy":"validation","validationCode":"// ensure every <table> has a non-empty name before loading\nfor (Element t : schemaTables(\"schema.xml\")) {\n    if (!t.hasAttribute(\"name\") || t.getAttribute(\"name\").trim().isEmpty())\n        throw new IllegalStateException(\"<table> missing name attribute\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    configLoader.load();\n} catch (ConfigException e) {\n    if (\"table name is not found!\".equals(e.getMessage())) {\n        log.error(\"A <table> element in schema.xml has no name attribute\", e);\n    }\n    throw e;\n}","preventionTips":["Validate schema.xml against an XSD/DTL before deployment","Avoid hand-edits to generated XML; fill template placeholders with non-empty values","Keep name attributes first in <table> elements to spot omissions in review"],"tags":["config","xml","missing-attribute"],"backgroundTag":"missing-required-config-field","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"}