MyCATApache/Mycat-Server · error · ConfigException
nameSuffix , require name parameter cannot multiple breaks!
Error message
nameSuffix ${tableNameSuffixElement}, require name parameter cannot multiple breaks! What it means
loadTable supports dynamic date-suffix table names via the nameSuffix attribute, but this feature works only for a single logical table. If the name attribute lists multiple comma-separated tables while nameSuffix is set, loadTable throws this ConfigException because the suffix expansion cannot be applied unambiguously to multiple names.
Solutions
- Split the comma-separated name attribute into separate <table> entries, each with its own nameSuffix.
- If the tables are not actually date-partitioned, remove the nameSuffix attribute so the multi-name list is allowed.
- Restart and confirm the schema loads.
Example fix
// before (schema.xml) <table name="order,order_log" dataNode="dn1" nameSuffix="_202401" /> // after <table name="order" dataNode="dn1" nameSuffix="_202401" /> <table name="order_log" dataNode="dn1" nameSuffix="_202401" />
Defensive patterns
Strategy: validation
Validate before calling
// nameSuffix cannot be combined with multi-name tables
NodeList tables = doc.getElementsByTagName("table");
for (int i = 0; i < tables.getLength(); i++) {
Element t = (Element) tables.item(i);
String suffix = t.getAttribute("nameSuffix");
if (!suffix.isEmpty() && t.getAttribute("name").contains(","))
throw new IllegalStateException("nameSuffix table must declare a single name: " + t.getAttribute("name"));
} Try / catch
try {
loader = new XMLSchemaLoader();
} catch (ConfigException e) {
if (e.getMessage() != null && e.getMessage().startsWith("nameSuffix")) {
LOG.error("nameSuffix requires single table name: {}", e.getMessage());
}
throw e;
} Prevention
- Use one <table> element per dynamically-suffixed table.
- Only add nameSuffix when you actually need date-based dynamic tables.
- Lint schema.xml: flag any table element with both a comma in name and a nameSuffix attribute.
When it happens
Trigger: schema.xml table element like <table name="t1,t2" nameSuffix="_202401" ...>; loadTable -> loadTables sees tableNameElement.split(",").length > 1 when nameSuffix is non-empty and throws.
Common situations: Bulk-declaring several date-partitioned tables in one line assuming multi-name support; copying a multi-table config line and adding nameSuffix for dynamic tables; misunderstanding that nameSuffix applies per table only.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- only one rule can defined
- can't find function of name
- table rule coulmns has multi values
- rule function duplicated!
- table rule duplicated!
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/e9872ab7aa950c9d.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/config/loader/xml/XMLSchemaLoader.java:331
}else {
list.add(tableElement);
}
}
loadTable(schemaName, tables, list);
return tables;
}
private void loadTable(String schemaName, Map<String, TableConfig> tables, List<Element> nodeList) {
for (int i = 0; i < nodeList.size(); i++) {
Element tableElement = (Element) nodeList.get(i);
String tableNameElement = tableElement.getAttribute("name").toUpperCase();
//TODO:路由, 增加对动态日期表的支持
String tableNameSuffixElement = tableElement.getAttribute("nameSuffix").toUpperCase();
if (!"".equals(tableNameSuffixElement)) {
if (tableNameElement.split(",").length > 1) {
throw new ConfigException("nameSuffix " + tableNameSuffixElement + ", require name parameter cannot multiple breaks!");
}
//前缀用来标明日期格式
tableNameElement = doTableNameSuffix(tableNameElement, tableNameSuffixElement);
}
//记录主键,用于之后路由分析,以及启用自增长主键
String[] tableNames = tableNameElement.split(",");
String primaryKey = tableElement.hasAttribute("primaryKey") ? tableElement.getAttribute("primaryKey").toUpperCase() : null;
//记录是否主键自增,默认不是,(启用全局sequence handler)
boolean autoIncrement = false;
if (tableElement.hasAttribute("autoIncrement")) {
autoIncrement = Boolean.parseBoolean(tableElement.getAttribute("autoIncrement"));
}
boolean fetchStoreNodeByJdbc = false;
if (tableElement.hasAttribute("fetchStoreNodeByJdbc")) {
fetchStoreNodeByJdbc = Boolean.parseBoolean(tableElement.getAttribute("fetchStoreNodeByJdbc"));
}
//记录是否需要加返回结果集限制,默认需要加View on GitHub (pinned to 65f8d8beb7)