{"record":{"id":"ca11d0a3eb7b1228","repo":"MyCATApache/Mycat-Server","slug":"find-no-route","errorCode":null,"errorMessage":" find no Route:","messagePattern":" find no Route:","errorType":"exception","errorClass":"SQLNonTransientException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/route/parser/druid/impl/DruidSelectParser.java","lineNumber":618,"sourceCode":"\t\t\t\tfor(String key: ctx.getTableAliasMap().keySet()){\r\n\t\t\t\t\tTableConfig tb_config = schema.getTables().get(key.toUpperCase());\r\n\t\t\t\t\tif(tb_config!=null){\r\n\t\t\t\t\t\tString table_name = ctx.getTableAliasMap().get(key);\r\n\t\t\t\t\t\tfor(String dataNode:tb_config.getDataNodes()){\r\n\t\t\t\t\t\t\tif(tb_config.getDataNodes().size()==1 || table_name.startsWith(dataNode+'.')){\r\n\t\t\t\t\t\t\t\trrs = RouterUtil.routeToSingleNode(rrs, dataNode, ctx.getSql());\r\n\t\t\t\t\t\t\t\trrs.setFinishedRoute(true);\r\n\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//end@byron\r\n\r\n\t\t\tString msg = \" find no Route:\" + ctx.getSql();\r\n\t\t\tLOGGER.warn(msg);\r\n\t\t\tthrow new SQLNonTransientException(msg);\r\n\t\t}\r\n\r\n\t\tRouteResultsetNode[] nodes = new RouteResultsetNode[nodeSet.size()];\r\n\t\tint i = 0;\r\n\t\tfor (Iterator<RouteResultsetNode> iterator = nodeSet.iterator(); iterator.hasNext();) {\r\n\t\t\tnodes[i] = (RouteResultsetNode) iterator.next();\r\n\t\t\ti++;\r\n\r\n\t\t}\r\n\r\n\t\trrs.setNodes(nodes);\r\n\t\trrs.setFinishedRoute(true);\r\n\t}\r\n\r\n\r\n\tprotected String getCurentDbType()\r\n\t{\r\n\t\treturn JdbcConstants.MYSQL.name();\r","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/route/parser/druid/impl/DruidSelectParser.java#L600-L636","documentation":"DruidSelectParser, after evaluating all routing conditions for a SELECT (sharding keys, global tables, broadcast rules), found an empty nodeSet — no datanode matches the query. It throws SQLNonTransientException ' find no Route:' followed by the SQL text.","triggerScenarios":"DruidSelectParser routing a SELECT where no WHERE-condition on the sharding column, ER join, or global-table rule yields any RouteResultsetNode — typically a query with no usable sharding condition on a non-global sharded table that has no broadcast fallback configured.","commonSituations":"SELECT on a sharded table without including the sharding column in WHERE; sharding rule misconfigured so no node matches; join conditions not recognized by MyCat's ER analysis; global table flag missing so cross-node queries can't resolve.","solutions":["Include the sharding/partition column in the WHERE clause so a datanode can be selected","Mark the table as global in schema.xml if it is a small lookup table broadcast to all nodes","Review the sharding rule in rule.xml to ensure the queried value maps to a node","If full-table scans are intended, configure the table/route strategy to broadcast to all datanodes"],"exampleFix":"// before\nSELECT * FROM orders;\n// after (orders sharded by customer_id)\nSELECT * FROM orders WHERE customer_id = 123;","handlingStrategy":"validation","validationCode":"if (!whereContainsShardingColumn(sql, table)) log.warn(\"query on sharded table without sharding column may fail routing: \" + table);","typeGuard":null,"tryCatchPattern":"try { query(sql); } catch (SQLNonTransientException e) { if (e.getMessage().startsWith(\" find no Route:\")) { fallbackToBroadcastOrReject(e); } else throw e; }","preventionTips":["Always filter sharded tables by their sharding key","Mark lookup tables as global in schema.xml","Test routing for all query patterns in the app","Catch the error and fall back to a fan-out query only when full scans are acceptable"],"tags":["sql","select","routing","sharding"],"backgroundTag":"empty-result-set","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"}