{"record":{"id":"13120f6a56b1e836","repo":"apache/seatunnel","slug":"list-tables-failed","errorCode":"LIST_TABLES_FAILED","errorMessage":"Cannot list tables from clickhouse","messagePattern":"Cannot list tables from clickhouse","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":347,"sourceCode":"                    .map(r -> r.getValue(0).asString())\n                    .collect(Collectors.toList());\n        } catch (ClickHouseException e) {\n            throw new ClickhouseConnectorException(\n                    SeaTunnelAPIErrorCode.LIST_DATABASES_FAILED,\n                    \"Cannot list databases from clickhouse\",\n                    e);\n        }\n    }\n\n    public List<String> listTable(String database) {\n        String sql = \"SELECT name FROM system.tables WHERE database = '\" + database + \"'\";\n        try (ClickHouseResponse response = clickhouseRequest.query(sql).executeAndWait()) {\n            Iterable<ClickHouseRecord> records = response.records();\n            return StreamSupport.stream(records.spliterator(), false)\n                    .map(r -> r.getValue(0).asString())\n                    .collect(Collectors.toList());\n        } catch (ClickHouseException e) {\n            throw new ClickhouseConnectorException(\n                    SeaTunnelAPIErrorCode.LIST_TABLES_FAILED,\n                    \"Cannot list tables from clickhouse\",\n                    e);\n        }\n    }\n\n    public void executeSql(String sql) {\n        try {\n            clickhouseRequest\n                    .write()\n                    .format(ClickHouseFormat.RowBinaryWithNamesAndTypes)\n                    .query(sql)\n                    .execute()\n                    .get();\n        } catch (InterruptedException | ExecutionException e) {\n            throw new RuntimeException(e);\n        }\n    }","sourceCodeStart":329,"sourceCodeEnd":365,"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#L329-L365","documentation":"ClickhouseProxy.listTable runs a query listing tables for a database from system.tables and wraps ClickHouseException into a ClickhouseConnectorException with LIST_TABLES_FAILED. It means the connector could not list tables in the requested database.","triggerScenarios":"Calling listTable when the underlying system.tables listing query fails — connection failure, bad credentials, unknown/misspelled database causing an error, or permission denial.","commonSituations":"Database name typo in config; user restricted to specific databases; transient network issues while browsing the catalog in tooling built on this proxy.","solutions":["Confirm the database exists: SHOW DATABASES; and fix the name","Grant the user privilege to read that database's catalog entries","Check connectivity/credentials and retry","Inspect the wrapped ClickHouseException for the precise server-side reason"],"exampleFix":"// before\nproxy.listTable(\"proddb \"); // trailing space in database name\n// after\nproxy.listTable(\"proddb\");","handlingStrategy":"validation","validationCode":"List<String> dbs = proxy.listDatabases();\nif (!dbs.contains(database)) {\n    throw new IllegalArgumentException(\"Unknown database: \" + database);\n}","typeGuard":null,"tryCatchPattern":"try {\n    return proxy.listTable(database);\n} catch (ClickhouseConnectorException e) {\n    LOG.error(\"Table listing failed for db {}\", database, e);\n    throw e;\n}","preventionTips":["Validate the database name (no whitespace, correct case) before listing","Grant catalog access for the target database","Cross-check with SHOW TABLES FROM <db> in clickhouse-client","Handle transient connection failures by retrying the listing"],"tags":["clickhouse","catalog","metadata"],"backgroundTag":"database-query-failed","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"}