{"record":{"id":"4ead46e41e0f5a06","repo":"apache/seatunnel","slug":"database-query-exception","errorCode":"DATABASE_QUERY_EXCEPTION","errorMessage":"DATABASE_QUERY_EXCEPTION","messagePattern":"DATABASE_QUERY_EXCEPTION","errorType":"error_code","errorClass":"HbaseConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java","lineNumber":133,"sourceCode":"        } catch (IOException e) {\n            String errorMsg = \"Build Hbase connection failed.\";\n            throw new HbaseConnectorException(\n                    HbaseConnectorErrorCode.CONNECTION_FAILED, errorMsg, e);\n        }\n    }\n\n    /**\n     * Check if a database exists.\n     *\n     * @param databaseName database name\n     * @return true if the database exists, false otherwise\n     */\n    public boolean databaseExists(String databaseName) {\n        try {\n            return Arrays.stream(admin.listNamespaceDescriptors())\n                    .anyMatch(descriptor -> descriptor.getName().equals(databaseName));\n        } catch (IOException e) {\n            throw new HbaseConnectorException(\n                    HbaseConnectorErrorCode.DATABASE_QUERY_EXCEPTION,\n                    HbaseConnectorErrorCode.DATABASE_QUERY_EXCEPTION.getErrorMessage(),\n                    e);\n        }\n    }\n\n    /**\n     * List all databases.\n     *\n     * @return List of database names\n     */\n    public List<String> listDatabases() {\n        try {\n            return Arrays.stream(admin.listNamespaceDescriptors())\n                    .map(NamespaceDescriptor::getName)\n                    .collect(Collectors.toList());\n        } catch (IOException e) {\n            throw new HbaseConnectorException(","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java#L115-L151","documentation":"databaseExists() lists HBase namespace descriptors via admin.listNamespaceDescriptors() to check if a namespace exists. If that admin call throws an IOException, it is wrapped as HbaseConnectorException with DATABASE_QUERY_EXCEPTION. It is used by createTable before creating the namespace.","triggerScenarios":"Calling HbaseClient.databaseExists() (directly or via createTable) when the Admin call to list namespaces fails: connection dropped, RPC timeout, permission denied on the namespace listing, or master not available.","commonSituations":"HBase master temporarily unavailable or restarting; RPC timeout under load; user lacks permission to list namespaces; transient network partition between SeaTunnel worker and cluster.","solutions":["Verify the HBase cluster and master are healthy (HBase UI / hbck)","Check that the connected user has permission to list namespaces","Inspect the wrapped IOException cause for RPC timeouts and tune hbase.rpc.timeout / client retries","Retry the operation after confirming connectivity"],"exampleFix":"// before\ntry {\n    return Arrays.stream(admin.listNamespaceDescriptors())\n            .anyMatch(d -> d.getName().equals(databaseName));\n} catch (IOException e) {\n    throw new HbaseConnectorException(HbaseConnectorErrorCode.DATABASE_QUERY_EXCEPTION, ...);\n}\n// after\ntry {\n    return Arrays.stream(admin.listNamespaceDescriptors())\n            .anyMatch(d -> d.getName().equals(databaseName));\n} catch (IOException e) {\n    log.warn(\"Namespace list failed, retrying\", e);\n    return Arrays.stream(admin.listNamespaceDescriptors())\n            .anyMatch(d -> d.getName().equals(databaseName));\n}","handlingStrategy":"try-catch","validationCode":"// verify admin/cluster health first\ntry (Connection c = ConnectionFactory.createConnection(conf); Admin a = c.getAdmin()) {\n    a.clusterStatus(); // throws early if cluster is not reachable\n}","typeGuard":null,"tryCatchPattern":"try {\n    exists = client.databaseExists(ns);\n} catch (HbaseConnectorException e) {\n    if (e.getErrorCode() == HbaseConnectorErrorCode.DATABASE_QUERY_EXCEPTION) {\n        // check cluster health / permissions, then retry\n    } else throw e;\n}","preventionTips":["Check master availability and user ACLs on namespaces before catalog operations","Tune hbase.rpc.timeout and client retry settings for loaded clusters","Call listDatabases once and cache results instead of repeated admin calls"],"tags":["hbase","database","query","admin"],"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-23T08:17:48.524Z"}