apache/shardingsphere · error · NoTablelessRouteInfoException

30

30

Error message

No tableless route info found.

What it means

TablelessRouteEngineFactory.newInstance routes statements that touch no logical table. After checking DML, DDL, DAL (with a TODO noting incomplete coverage), and TCL, any remaining statement category falls through to NoTablelessRouteInfoException (error code 30) — ShardingSphere has no tableless routing strategy for that statement type against the target database.

Source

Thrown at infra/route/core/src/main/java/org/apache/shardingsphere/infra/route/engine/tableless/TablelessRouteEngineFactory.java:82

     * @throws NoTablelessRouteInfoException if the SQL statement is not supported by tableless route engine
     */
    public static TablelessRouteEngine newInstance(final QueryContext queryContext, final ShardingSphereDatabase database) {
        SQLStatement sqlStatement = queryContext.getSqlStatementContext().getSqlStatement();
        if (sqlStatement instanceof DMLStatement) {
            return getDMLRouteEngine(queryContext.getSqlStatementContext());
        }
        if (sqlStatement instanceof DDLStatement) {
            return getDDLRouteEngine(queryContext.getSqlStatementContext(), database);
        }
        // TODO remove this logic when proxy and jdbc support all dal statement @duanzhengqiang
        if (sqlStatement instanceof DALStatement) {
            return getDALRouteEngine((DALStatement) sqlStatement, database);
        }
        // TODO Support more TCL statements by transaction module, then remove this.
        if (sqlStatement instanceof TCLStatement) {
            return new TablelessDataSourceBroadcastRouteEngine();
        }
        throw new NoTablelessRouteInfoException();
    }
    
    private static TablelessRouteEngine getDMLRouteEngine(final SQLStatementContext sqlStatementContext) {
        if (sqlStatementContext instanceof SelectStatementContext) {
            return new TablelessDataSourceUnicastRouteEngine();
        }
        throw new NoTablelessRouteInfoException();
    }
    
    private static TablelessRouteEngine getDDLRouteEngine(final SQLStatementContext sqlStatementContext, final ShardingSphereDatabase database) {
        if (sqlStatementContext.getSqlStatement().getAttributes().findAttribute(CursorSQLStatementAttribute.class).isPresent()) {
            return getCursorRouteEngine(sqlStatementContext.getSqlStatement(), database);
        }
        SQLStatement sqlStatement = sqlStatementContext.getSqlStatement();
        if (isFunctionDDLStatement(sqlStatement) || isSchemaDDLStatement(sqlStatement)) {
            return new TablelessDataSourceBroadcastRouteEngine();
        }
        throw new NoTablelessRouteInfoException();

View on GitHub (pinned to e952770a21)

Solutions

  1. Run the statement against a logical database that actually contains tables, or route it directly to the underlying datasource bypassing ShardingSphere.
  2. Add at least one logical table (or a single-table rule) so the statement routes through the table-based router.
  3. Upgrade ShardingSphere — tableless statement coverage is actively expanding (see the TODOs) — and check release notes for your statement type.

Example fix

# before: logical DB has no tables
REPLICAOF node2 6379;  # utility statement hits tableless router -> NoTablelessRouteInfoException

# after: connect to the physical storage unit directly for admin/utility statements
Defensive patterns

Strategy: validation

Try / catch

try { route(engine, queryContext); } catch (NoTablelessRouteInfoException e) { /* route statement directly to a storage unit */ }

Prevention

When it happens

Trigger: Executing a statement in a database with no logical tables where the statement is not DML/DDL/DAL/TCL — e.g. certain administration or utility statements (_replicaof, LOCK/UNLOCK variants not classified as DAL) that reach the tableless router.

Common situations: Pointing a client at a ShardingSphere logical database that has no tables yet (fresh setup) and running session/admin utilities; HA failover tools issuing database-specific commands; statements whose parser classification changed between versions.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/85de8438bce64c11. Report an issue: GitHub.