{"record":{"id":"d27390efaa7ef6da","repo":"MyCATApache/Mycat-Server","slug":"no-rule-column-is-found","errorCode":null,"errorMessage":"no rule column is found","messagePattern":"no rule column is found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/config/model/rule/RuleConfig.java","lineNumber":45,"sourceCode":"\r\nimport java.io.Serializable;\r\n\r\n/**\r\n * 分片规则，column是用于分片的数据库物理字段\r\n * @author mycat\r\n */\r\npublic class RuleConfig implements Serializable {\r\n\tprivate final String column;\r\n\tprivate final String functionName;\r\n\tprivate AbstractPartitionAlgorithm ruleAlgorithm;\r\n\r\n\tpublic RuleConfig(String column, String functionName) {\r\n\t\tif (functionName == null) {\r\n\t\t\tthrow new IllegalArgumentException(\"functionName is null\");\r\n\t\t}\r\n\t\tthis.functionName = functionName;\r\n\t\tif (column == null || column.length() <= 0) {\r\n\t\t\tthrow new IllegalArgumentException(\"no rule column is found\");\r\n\t\t}\r\n\t\tthis.column = column;\r\n\t}\r\n\r\n\t\r\n\r\n\tpublic AbstractPartitionAlgorithm getRuleAlgorithm() {\r\n\t\treturn ruleAlgorithm;\r\n\t}\r\n\r\n\r\n\r\n\tpublic void setRuleAlgorithm(AbstractPartitionAlgorithm ruleAlgorithm) {\r\n\t\tthis.ruleAlgorithm = ruleAlgorithm;\r\n\t}\r\n\r\n\r\n\r","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/config/model/rule/RuleConfig.java#L27-L63","documentation":"After validating functionName, RuleConfig's constructor requires a non-null, non-empty rule column. If column is null or length <= 0, IllegalArgumentException(\"no rule column is found\") is thrown — the sharding rule must know which column's values feed the partition algorithm.","triggerScenarios":"new RuleConfig(null, fn) or new RuleConfig(\"\", fn), typically from a rule.xml <rule> element whose <columns> element is missing or empty.","commonSituations":"rule.xml rule entry missing <columns>id</columns>; empty columns element; renaming a column in the schema without updating the rule definition.","solutions":["Add <columns>yourShardingColumn</columns> inside the <rule> element in rule.xml.","Ensure the column value is non-empty and matches a real column of the sharded table.","If constructing RuleConfig programmatically, pass a non-empty column string."],"exampleFix":"// before (rule.xml)\n<rule><function>mod-long</function></rule>\n// after\n<rule><columns>id</columns><function>mod-long</function></rule>","handlingStrategy":"validation","validationCode":"if (column == null || column.isEmpty()) throw new IllegalArgumentException(\"rule columns element required\");","typeGuard":null,"tryCatchPattern":"try { new RuleConfig(column, fn); } catch (IllegalArgumentException e) { if (\"no rule column is found\".equals(e.getMessage())) { LOG.error(\"rule missing <columns>\"); } throw e; }","preventionTips":["Always include <columns> in every rule definition in rule.xml.","Keep sharding column names in sync with actual table schemas.","Run rule.xml schema validation in CI."],"tags":["config","mycat","rule","missing-field"],"backgroundTag":"missing-required-config-field","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"}