{"record":{"id":"1e6abe0497a5ebcb","repo":"apache/seatunnel","slug":"table-not-existed","errorCode":"TABLE_NOT_EXISTED","errorMessage":"Cannot get table from clickhouse, resultSet is empty","messagePattern":"Cannot get table from clickhouse, resultSet is empty","errorType":"error_code","errorClass":"ClickhouseConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/util/ClickhouseProxy.java","lineNumber":119,"sourceCode":"                                .collect(Collectors.toList());\n\n                String clusterName = infos.get(0);\n                String localDatabase = infos.get(1);\n                String localTable = infos.get(2).replace(\")\", \"\").trim();\n\n                String localTableSQL =\n                        String.format(\n                                \"select engine,create_table_query,sorting_key from system.tables where database = '%s' and name = '%s'\",\n                                localDatabase, localTable);\n                String localTableDDL;\n                String localTableEngine;\n                String sortingKey;\n                try (ClickHouseResponse localTableResponse =\n                        clickhouseRequest.query(localTableSQL).executeAndWait()) {\n                    List<ClickHouseRecord> localTableRecords =\n                            localTableResponse.stream().collect(Collectors.toList());\n                    if (localTableRecords.isEmpty()) {\n                        throw new ClickhouseConnectorException(\n                                SeaTunnelAPIErrorCode.TABLE_NOT_EXISTED,\n                                \"Cannot get table from clickhouse, resultSet is empty\");\n                    }\n                    localTableEngine = localTableRecords.get(0).getValue(0).asString();\n                    localTableDDL = localTableRecords.get(0).getValue(1).asString();\n                    localTableDDL = localizationEngine(localTableEngine, localTableDDL);\n                    sortingKey = localTableRecords.get(0).getValue(2).asString();\n                }\n\n                return new DistributedEngine(\n                        clusterName,\n                        localDatabase,\n                        localTable,\n                        localTableEngine,\n                        localTableDDL,\n                        sortingKey);\n            }\n            throw new ClickhouseConnectorException(","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/util/ClickhouseProxy.java#L101-L137","documentation":"ClickhouseProxy.getClickhouseDistributedTable() queries ClickHouse (system.tables via localTableSQL) to fetch the local table's engine and DDL; if the query returns no rows, it wraps the result as SeaTunnelAPIErrorCode.TABLE_NOT_EXISTED with 'Cannot get table from clickhouse, resultSet is empty'. It means ClickHouse returned nothing for the requested local table metadata, effectively the table doesn't exist or isn't visible.","triggerScenarios":"SELECT of engine/DDL for a local table where system.tables has no matching row — wrong database/table name, missing privileges, table dropped, or cluster-function query (clusterAllReplicas) returning no rows from unreachable shards.","commonSituations":"Typo'd database or table in source config; connecting with a user lacking SELECT on system.tables; pointing at a cluster where the local table exists only on other shards; case-sensitive name mismatch.","solutions":["Verify database/table names in config match ClickHouse exactly (case-sensitive) via `SHOW TABLES FROM <db>`.","Check grants: the connector user needs SELECT on the target table and system.tables.","Confirm the table exists on every shard reachable by the configured url/cluster clause.","Run the metadata SQL manually (SELECT engine, create_table_query FROM system.tables WHERE database=... AND name=...) to see why it returns empty."],"exampleFix":"// before\nurl = \"jdbc:clickhouse://ch-host:8123\"\ndatabase = \"Default\"   // wrong case\n// after\nurl = \"jdbc:clickhouse://ch-host:8123\"\ndatabase = \"default\"\ntable = \"events_local\"","handlingStrategy":"validation","validationCode":"// Run before job submission\nSELECT engine, create_table_query FROM system.tables\nWHERE database = 'default' AND name = 'events_local';\n// empty result -> connector will throw TABLE_NOT_EXISTED","typeGuard":null,"tryCatchPattern":"try {\n  catalog.getTable(path);\n} catch (ClickhouseConnectorException e) {\n  if (e.getSeaTunnelErrorCode() == SeaTunnelAPIErrorCode.TABLE_NOT_EXISTED) {\n    // verify names/grants, then re-create or reconfigure\n  } else throw e;\n}","preventionTips":["Verify database/table names with SHOW TABLES before configuring.","Grant the connector user SELECT on target tables and system.tables.","Confirm the table exists on all shards reachable from the configured URL.","Watch for dropped/renamed tables in environments with schema migrations."],"tags":["clickhouse","table-not-found","metadata","empty-result"],"backgroundTag":"empty-result-set","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}