{"record":{"id":"8706a60234991dea","repo":"apache/seatunnel","slug":"table-truncate-exception","errorCode":"TABLE_TRUNCATE_EXCEPTION","errorMessage":"HbaseConnectorErrorCode.TABLE_TRUNCATE_EXCEPTION.getErrorMessage()","messagePattern":"HbaseConnectorErrorCode\\.TABLE_TRUNCATE_EXCEPTION\\.getErrorMessage\\(\\)","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":280,"sourceCode":"            admin.createNamespace(NamespaceDescriptor.create(namespace).build());\n        } catch (IOException e) {\n            throw new HbaseConnectorException(\n                    HbaseConnectorErrorCode.NAMESPACE_CREATE_EXCEPTION,\n                    HbaseConnectorErrorCode.NAMESPACE_CREATE_EXCEPTION.getErrorMessage(),\n                    e);\n        }\n    }\n\n    /**\n     * Drop a namespace.\n     *\n     * @param namespace namespace name\n     */\n    public void deleteNamespace(String namespace) {\n        try {\n            admin.deleteNamespace(namespace);\n        } catch (IOException e) {\n            throw new HbaseConnectorException(\n                    HbaseConnectorErrorCode.NAMESPACE_DELETE_EXCEPTION,\n                    HbaseConnectorErrorCode.NAMESPACE_DELETE_EXCEPTION.getErrorMessage(),\n                    e);\n        }\n    }\n\n    /**\n     * Truncate a table.\n     *\n     * @param databaseName database name\n     * @param tableName table name\n     */\n    public void truncateTable(String databaseName, String tableName) {\n        try {\n            TableName table = TableName.valueOf(databaseName, tableName);\n            admin.disableTable(table);\n            admin.truncateTable(table, true);\n        } catch (IOException e) {","sourceCodeStart":262,"sourceCodeEnd":298,"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#L262-L298","documentation":"Deleting an HBase namespace via admin.deleteNamespace threw an IOException, wrapped as HbaseConnectorException with NAMESPACE_DELETE_EXCEPTION. This is thrown because namespace deletion requires the namespace to exist, be empty (no tables), and the caller to have admin permission. The failure is deferred to the caller as a connector exception.","triggerScenarios":"Calling HbaseClient.deleteNamespace(namespace) when admin.deleteNamespace throws IOException — typically namespace does not exist, namespace still contains tables, or connection/permission problems.","commonSituations":"Trying to drop a namespace that still has tables enabled/disabled; typo in namespace name; cluster connectivity loss mid-operation.","solutions":["Disable and drop (or truncate/delete) all tables in the namespace before deleting it","Verify the namespace exists with 'list_namespace' in HBase shell","Check permissions (ADMIN on the namespace) for the connected user","Review the wrapped IOException cause for the exact HBase failure"],"exampleFix":"// before\nclient.deleteNamespace(\"old_ns\");\n// after\nfor (TableName t : client.listTables(\"old_ns\")) { client.dropTable(t); }\nclient.deleteNamespace(\"old_ns\");","handlingStrategy":"validation","validationCode":"// pre-check: namespace empty and exists\nboolean empty = admin.listTableNamesByNamespace(ns).length == 0;\nboolean exists = namespaceExists(admin, ns);\nif (exists && empty) admin.deleteNamespace(ns);","typeGuard":"boolean canDeleteNamespace(Admin admin, String ns) throws IOException {\n    return namespaceExists(admin, ns) && admin.listTableNamesByNamespace(ns).length == 0;\n}","tryCatchPattern":"try { client.deleteNamespace(ns); }\ncatch (HbaseConnectorException e) {\n    Throwable c = e.getCause();\n    if (c instanceof NamespaceNotFoundException) { /* already gone */ }\n    else if (c.getMessage() != null && c.getMessage().contains(\"only empty\")) { /* drop tables first */ }\n    else throw e;\n}","preventionTips":["Drop/disable all tables in the namespace before deleting it","Confirm the namespace name against list_namespace","Verify ADMIN permission for the user"],"tags":["hbase","namespace","admin-operation","io-exception"],"backgroundTag":"database-write-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"}