{"record":{"id":"9cdaf96d540985f9","repo":"MyCATApache/Mycat-Server","slug":"selfcheck-users-node-within-the-item-is-empty","errorCode":null,"errorMessage":"SelfCheck### users node within the item is empty!","messagePattern":"SelfCheck### users node within the item is empty!","errorType":"exception","errorClass":"io.mycat.config.ConfigException","httpStatus":null,"severity":"critical","filePath":"src/main/java/io/mycat/config/ConfigInitializer.java","lineNumber":131,"sourceCode":"\t\t}\n\t\t\n\t\t/**\n\t\t * 配置文件初始化， 自检\n\t\t */\n\t\tthis.selfChecking0();\n\t}\n\t\n\tprivate void selfChecking0() throws ConfigException {\n\t\t\n\t\t// 检查user与schema配置对应以及schema配置不为空\n\t\tif (users == null || users.isEmpty()) {\n\t\t\tthrow new ConfigException(\"SelfCheck### user all node is empty!\");\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\tfor (UserConfig uc : users.values()) {\n\t\t\t\tif (uc == null) {\n\t\t\t\t\tthrow new ConfigException(\"SelfCheck### users node within the item is empty!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tSet<String> authSchemas = uc.getSchemas();\n\t\t\t\tif (authSchemas == null) {\n\t\t\t\t\tthrow new ConfigException(\"SelfCheck### user \" + uc.getName() + \"refered schemas is empty!\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (String schema : authSchemas) {\n\t\t\t\t\tif ( !schemas.containsKey(schema) ) {\n\t\t\t\t\t\tString errMsg = \"SelfCheck###  schema \" + schema + \" refered by user \" + uc.getName() + \" is not exist!\";\n\t\t\t\t\t\tthrow new ConfigException(errMsg);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\t\n\t\t\n\t\t\n\t\t// schema 配置检测\t\t","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/ConfigInitializer.java#L113-L149","documentation":"selfChecking0 iterates the configured users and throws ConfigException if any individual UserConfig entry is null. This means the users map contains a key whose value failed to be built during config parsing (malformed user XML block), leaving an empty item. It guards against half-parsed user definitions causing NPEs later during authentication.","triggerScenarios":"A <user> block in server.xml is present but so malformed that UserConfig construction fails or yields null while the key is still registered — e.g. missing required password/schema properties causing a parse path that stores a null entry.","commonSituations":"Hand-edited server.xml with an unclosed tag or missing <property> children; wrong property names so the user object cannot be constructed; version upgrades where user config format changed and old files parse to null entries.","solutions":["Inspect server.xml user blocks for malformed XML or missing required properties (password, schemas) and fix them","Remove the broken <user> entry entirely if it is not needed, leaving only valid users","Compare your user config with the default template for your Mycat version and correct property names","Check earlier startup logs for a warning/exception during user config parsing that explains the null entry"],"exampleFix":"<!-- before: malformed user -->\n<user name=\"root\">\n  <property name=\"pass\">123456</property>\n</user>\n// after\n<user name=\"root\">\n  <property name=\"password\">123456</property>\n  <property name=\"schemas\">TESTDB</property>\n</user>","handlingStrategy":"validation","validationCode":"// validate each user block has required properties before startup (shell)\n// every <user> must contain password and schemas properties\ngrep -A3 '<user ' conf/server.xml | grep -E 'password|schemas' || echo 'malformed user block'","typeGuard":null,"tryCatchPattern":"try {\n    new ConfigInitializer(isLoadMysql);\n} catch (ConfigException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"users node within the item is empty\")) {\n        LOG.error(\"A <user> block in server.xml is malformed and produced a null user config\");\n    }\n    throw e;\n}","preventionTips":["Always include password and schemas properties in every <user> block","Validate XML well-formedness (xmllint) after hand-editing server.xml","Diff user config against the version's template after Mycat upgrades","Remove unused/broken user entries instead of leaving half-edited blocks"],"tags":["config","startup","user","mycat"],"backgroundTag":"schema-validation-failed","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}