MyCATApache/Mycat-Server · error · ConfigException

group should contain 'nodeList'

Error message

group should contain 'nodeList'

What it means

loadGroup requires each <group> element to provide a non-empty 'nodeList' property listing its member nodes (comma-separated). If props.get("nodeList") is null or empty, ConfigException 'group should contain nodeList' is thrown at ClusterConfig.java:117.

Solutions

  1. Add a nodeList property naming existing nodes: <property name="nodeList">nodeM1,nodeM2</property>.
  2. Ensure the property name is exactly 'nodeList' (camelCase) and non-empty.
  3. Confirm the referenced node names exist (else the follow-up 'doesn't exist' error fires).
  4. Restart Mycat to reload the config.

Example fix

<!-- before -->
<group name="group1">
  <property name="weight">0</property>
</group>
<!-- after -->
<group name="group1">
  <property name="nodeList">nodeM1,nodeM2</property>
</group>
Defensive patterns

Strategy: validation

Validate before calling

var nl = doc.getElementsByTagName("group");
for (int i = 0; i < nl.getLength(); i++) {
  var el = (Element) nl.item(i);
  String v = propOf(el, "nodeList");
  if (v == null || v.trim().isEmpty()) throw new IllegalStateException("group " + el.getAttribute("name") + " missing nodeList");
}

Try / catch

try { new ClusterConfig(); } catch (ConfigException e) { if (e.getMessage().contains("group should contain 'nodeList'")) { log.error("Add nodeList property to <group> in cluster.xml"); } throw e; }

Prevention

When it happens

Trigger: A <group name="X"> element has no <property name="nodeList"> child or its value is empty; thrown during loadGroup.

Common situations: Newly added group left empty before members were assigned, deleted nodeList line during editing, or a misspelled property (nodelist vs nodeList).

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at src/main/java/io/mycat/config/model/ClusterConfig.java:117

        return nodes;
    }

    private static Map<String, List<String>> loadGroup(Element root, Map<String, MycatNodeConfig> nodes) {
        Map<String, List<String>> groups = new HashMap<String, List<String>>();
        NodeList list = root.getElementsByTagName("group");
        for (int i = 0, n = list.getLength(); i < n; i++) {
            Node node = list.item(i);
            if (node instanceof Element) {
                Element e = (Element) node;
                String groupName = e.getAttribute("name").trim();
                if (groups.containsKey(groupName)) {
                    throw new ConfigException("group duplicated : " + groupName);
                }

                Map<String, Object> props = ConfigUtil.loadElements(e);
                String value = (String) props.get("nodeList");
                if (null == value || "".equals(value)) {
                    throw new ConfigException("group should contain 'nodeList'");
                }

                String[] sList = SplitUtil.split(value, ',', true);

                if (null == sList || sList.length == 0) {
                    throw new ConfigException("group should contain 'nodeList'");
                }

                for (String s : sList) {
                    if (!nodes.containsKey(s)) {
                        throw new ConfigException("[ node :" + s + "] in [ group:" + groupName + "] doesn't exist!");
                    }
                }
                List<String> nodeList = Arrays.asList(sList);
                groups.put(groupName, nodeList);
            }
        }
        if (!groups.containsKey("default")) {

View on GitHub (pinned to 65f8d8beb7)