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

SelfCheck### schema

Error message

SelfCheck###  schema {schema} refered by user {userName} is not exist!

What it means

Thrown by ConfigInitializer.selfChecking0 during startup self-check when a user's schemas set contains a schema name that does not exist in the loaded schema.xml configuration. MyCat validates that every schema referenced by a user resolves to a defined <schema> node; otherwise authorization and routing would break, so it fails fast with ConfigException.

Solutions

  1. Open server.xml and find the user whose schemas property lists the missing schema name (named in the message).
  2. Fix the schema name in server.xml to exactly match a <schema name="..."> in schema.xml, or create the missing schema in schema.xml.
  3. Check for case mismatches between the two files.
  4. Reload/restart MyCat and confirm the self-check passes.

Example fix

// before (server.xml)
<property name="schemas">testdb2</property>
// after (schema.xml has <schema name="testdb">)
<property name="schemas">testdb</property>
Defensive patterns

Strategy: validation

Validate before calling

// Validate every user schema reference exists before init
for (UserConfig uc : users.values()) {
    for (String s : uc.getSchemas()) {
        if (!schemas.containsKey(s)) {
            throw new IllegalArgumentException("schema " + s + " referenced by user " + uc.getName() + " not found");
        }
    }
}

Try / catch

try {
    initializer = new ConfigInitializer(...);
} catch (ConfigException e) {
    if (e.getMessage().contains("is not exist")) {
        LOGGER.error("Dangling user->schema reference: {}", e.getMessage());
        // abort deploy or roll back config
    } else { throw e; }
}

Prevention

When it happens

Trigger: ConfigInitializer constructor with a server.xml user whose schemas property lists a name not present in the schemas map loaded from schema.xml (typo, renamed or removed schema, case mismatch).

Common situations: Renaming a schema in schema.xml without updating server.xml users; deleting a schema that is still referenced; case sensitivity mismatch (TESTDB vs testdb); leftover users from copy-pasted example configs pointing at nonexistent schemas.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

		if (users == null || users.isEmpty()) {
			throw new ConfigException("SelfCheck### user all node is empty!");
			
		} else {
			
			for (UserConfig uc : users.values()) {
				if (uc == null) {
					throw new ConfigException("SelfCheck### users node within the item is empty!");
				}
				
				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);

View on GitHub (pinned to 65f8d8beb7)