MyCATApache/Mycat-Server · error · IllegalArgumentException

invalid table subTables

Error message

invalid table subTables

What it means

When a TableConfig has a non-empty subTables value, TableConfig splits it with SplitUtil.split and requires at least one resulting table name. If the split yields null or an empty array, IllegalArgumentException("invalid table subTables") is thrown — the subTables attribute exists but resolves to no actual sub-table names.

Solutions

  1. Provide a concrete comma-separated sub-table list, e.g. subTables="orders_0,orders_1" or a valid range like orders$0-127.
  2. Remove stray commas or whitespace-only entries from the subTables value.
  3. If no sub-tables are intended, omit the subTables attribute entirely so the branch is skipped.

Example fix

// before (schema.xml)
<table name="orders" dataNode="dn1" subTables=", ," />
// after
<table name="orders" dataNode="dn1" subTables="orders$0-orders$2" />
Defensive patterns

Strategy: validation

Validate before calling

if (subTables != null && !subTables.isEmpty()) {
    String[] st = SplitUtil.split(subTables, ',', '$', '-');
    if (st == null || st.length == 0) throw new IllegalArgumentException("invalid subTables for table " + tableName);
}

Try / catch

try { new TableConfig(...); } catch (IllegalArgumentException e) { if ("invalid table subTables".equals(e.getMessage())) { LOG.error("subTables set but resolves to no names"); } throw e; }

Prevention

When it happens

Trigger: subTables is non-null and non-empty but SplitUtil.split(subTables, ',', '$', '-') returns null or length 0 — e.g. only delimiters/whitespace such as subTables=",,".

Common situations: schema.xml table element with subTables="" patterns of commas; copy-paste leaving just separators; malformed range expression in the subTables list.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/a3688948280d5751. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/config/model/TableConfig.java:98

        this.dbTypes = dbType;
        if (ruleRequired && rule == null) {
            throw new IllegalArgumentException("ruleRequired but rule is null");
        }

        this.name = tableName.toUpperCase();
        String theDataNodes[] = SplitUtil.split(dataNode, ',', '$', '-');
        if (theDataNodes == null || theDataNodes.length <= 0) {
            throw new IllegalArgumentException("invalid table dataNodes: " + dataNode);
        }
        dataNodes = new ArrayList<String>(theDataNodes.length);
        for (String dn : theDataNodes) {
            dataNodes.add(dn);
        }

        if (subTables != null && !subTables.equals("")) {
            String sTables[] = SplitUtil.split(subTables, ',', '$', '-');
            if (sTables == null || sTables.length <= 0) {
                throw new IllegalArgumentException("invalid table subTables");
            }
            this.distTables = new ArrayList<String>(sTables.length);
            for (String table : sTables) {
                distTables.add(table);
            }
        } else {
            this.distTables = new ArrayList<String>();
        }

        this.rule = rule;
        this.partitionColumn = (rule == null) ? null : rule.getColumn();
        partionKeyIsPrimaryKey = (partitionColumn == null) ? primaryKey == null : partitionColumn.equals(primaryKey);
        this.ruleRequired = ruleRequired;
        this.childTable = isChildTable;
        this.parentTC = parentTC;
        this.joinKey = joinKey;
        this.parentKey = parentKey;
        if (parentTC != null) {

View on GitHub (pinned to 65f8d8beb7)