{"record":{"id":"bfd0a085120cb4bc","repo":"MyCATApache/Mycat-Server","slug":"can-t-find-table-define-in-schema-tablename-sch","errorCode":null,"errorMessage":"can't find table define in schema ${tableName} schema:${schema.getName()}","messagePattern":"can't find table define in schema (.+?) schema:(.+?)","errorType":"exception","errorClass":"java.sql.SQLNonTransientException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/util/RouterUtil.java","lineNumber":1437,"sourceCode":"\t}\r\n\r\n\tprivate static RouteResultset routeToDistTableNode(SchemaConfig schema, RouteResultset rrs,\r\n        String orgSql, Map<String, Map<String, Set<ColumnRoutePair>>> tablesAndConditions,\r\n        LayerCachePool cachePool, boolean isSelect, Map.Entry<String, Map<String, Set<ColumnRoutePair>>> entry) throws SQLNonTransientException {\r\n\r\n\r\n        String tableName = null;\r\n        if (entry != null) {\r\n            tableName = entry.getKey().toUpperCase();\r\n        } else {\r\n            List<String> tables = rrs.getTables();\r\n            tableName = tables.get(0);\r\n        }\r\n        TableConfig tableConfig = schema.getTables().get(tableName);\r\n        if(tableConfig == null) {\r\n            String msg = \"can't find table define in schema \" + tableName + \" schema:\" + schema.getName();\r\n            LOGGER.warn(msg);\r\n            throw new SQLNonTransientException(msg);\r\n        }\r\n        if(tableConfig.isGlobalTable()){\r\n            String msg = \"can't suport district table  \" + tableName + \" schema:\" + schema.getName() + \" for global table \";\r\n            LOGGER.warn(msg);\r\n            throw new SQLNonTransientException(msg);\r\n        }\r\n        String partionCol = tableConfig.getPartitionColumn();\r\n    //  String primaryKey = tableConfig.getPrimaryKey();\r\n        //boolean isLoadData=false;\r\n    \r\n        Set<String> tablesRouteSet = new HashSet<String>();\r\n    \r\n        List<String> dataNodes = tableConfig.getDataNodes();\r\n        if(dataNodes.size()>1){\r\n            String msg = \"can't suport district table  \" + tableName + \" schema:\" + schema.getName() + \" for mutiple dataNode \" + dataNodes;\r\n            LOGGER.warn(msg);\r\n            throw new SQLNonTransientException(msg);\r\n        }\r","sourceCodeStart":1419,"sourceCodeEnd":1455,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/util/RouterUtil.java#L1419-L1455","documentation":"Thrown when routing a district (dist) table and the table name from the SQL is not defined in the schema's tables map. Like the general table lookup, the dist-table path requires a TableConfig in schema.xml.","triggerScenarios":"Calling the dist-table routing path (routeToDistTableNode flow) with a table that has no TableConfig in the current schema — table missing from schema.xml or name/case mismatch.","commonSituations":"distTables configured via placeholders but base table forgotten in schema.xml; SQL uses lowercase name while config uses uppercase; wrong logical schema selected.","solutions":["Declare the table in schema.xml with its distTables configuration and reload","Match the table name casing used in schema.xml (Mycat upper-cases lookups)","Confirm the client is using the correct Mycat schema name"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"TableConfig tc = schema.getTables().get(tableName.toUpperCase());\nif (tc == null) throw new IllegalArgumentException(\"dist table not defined: \" + tableName);","typeGuard":null,"tryCatchPattern":"try { rrs = route(...); } catch (SQLNonTransientException e) { if (e.getMessage().startsWith(\"can't find table define\")) { LOG.warn(\"check schema.xml dist table config\"); } throw e; }","preventionTips":["Declare dist tables explicitly in schema.xml","Standardize table-name casing across SQL and config","Reload and verify config after dist-table changes"],"tags":["config","routing","dist-table"],"backgroundTag":"entity-not-found","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"}