MyCATApache/Mycat-Server · error · io.mycat.config.ConfigException

SelfCheck### schema all node is empty!

Error message

SelfCheck### schema all node is empty!

What it means

Thrown by ConfigInitializer.selfChecking0 during the schema configuration check when a SchemaConfig value in the schemas map is null. The schemas map is expected to contain only fully-parsed schema configurations; a null entry indicates an internal parsing/registration invariant was violated, so startup aborts with ConfigException.

Solutions

  1. Review schema.xml for malformed <schema> definitions (missing name attribute, unclosed tags) that could parse to a null entry.
  2. If using a custom/patched ConfigInitializer, verify every put into the schemas map passes a non-null SchemaConfig.
  3. Restore stock MyCat config-loading code if it was modified.
  4. Restart with a known-good schema.xml to isolate whether the file or the loader is at fault.

Example fix

// before (custom loader)
schemas.put(schemaName, parseSchema(cfg)); // may be null
// after
SchemaConfig sc = parseSchema(cfg);
if (sc == null) {
    throw new ConfigException("schema " + schemaName + " failed to parse");
}
schemas.put(schemaName, sc);
Defensive patterns

Strategy: try-catch

Validate before calling

// Check schemas map for null entries before handing to self-check
schemas.values().forEach(sc -> {
    if (sc == null) throw new IllegalStateException("null SchemaConfig in schemas map");
});

Type guard

boolean isValidSchemaMap(Map<String, SchemaConfig> schemas) {
    return schemas != null && schemas.values().stream().noneMatch(java.util.Objects::isNull);
}

Try / catch

try {
    new ConfigInitializer(...);
} catch (ConfigException e) {
    if (e.getMessage().contains("schema all node is empty")) {
        LOGGER.error("Null SchemaConfig registered; check config loader/fork: {}", e.getMessage());
    } else { throw e; }
}

Prevention

When it happens

Trigger: ConfigInitializer constructor where the schemas map built from schema.xml contains a null SchemaConfig value — typically from custom/modified loading code or corrupted merge of schema definitions rather than ordinary config typos.

Common situations: Custom forks or patches to MyCat config loading that put entries into the map without a valid SchemaConfig; programmatic construction of the config map in tests/embedding code where a schema was registered as null; corrupted config reload state.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at src/main/java/io/mycat/config/ConfigInitializer.java:152

				Set<String> authSchemas = uc.getSchemas();
				if (authSchemas == null) {
					throw new ConfigException("SelfCheck### user " + uc.getName() + "refered schemas is empty!");
				}
				
				for (String schema : authSchemas) {
					if ( !schemas.containsKey(schema) ) {
						String errMsg = "SelfCheck###  schema " + schema + " refered by user " + uc.getName() + " is not exist!";
						throw new ConfigException(errMsg);
					}
				}
			}
		}	
		
		
		// schema 配置检测		
		for (SchemaConfig sc : schemas.values()) {
			if (null == sc) {
				throw new ConfigException("SelfCheck### schema all node is empty!");
				
			} else {				
				// check dataNode / dataHost 节点
				if ( this.dataNodes != null &&  this.dataHosts != null  ) {					
					Set<String> dataNodeNames = sc.getAllDataNodes();
					for(String dataNodeName: dataNodeNames) {
						
						PhysicalDBNode node = this.dataNodes.get(dataNodeName);
						if ( node == null ) {
							throw new ConfigException("SelfCheck### schema dbnode is empty!");
						}
					}
				}
			}
		}	
		
	}
	

View on GitHub (pinned to 65f8d8beb7)