{"record":{"id":"d739f700e22aac70","repo":"apache/seatunnel","slug":"table-exists-exception","errorCode":"TABLE_EXISTS_EXCEPTION","errorMessage":"HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION.getErrorMessage()","messagePattern":"HbaseConnectorErrorCode\\.TABLE_EXISTS_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":215,"sourceCode":"     * @param databaseName database name\n     * @param tableName table name\n     * @param columnFamilies column families\n     * @param ignoreIfExists ignore if the table already exists\n     */\n    public void createTable(\n            String databaseName,\n            String tableName,\n            List<String> columnFamilies,\n            boolean ignoreIfExists) {\n        try {\n            if (!databaseExists(databaseName) && !StringUtils.isBlank(databaseName)) {\n                admin.createNamespace(NamespaceDescriptor.create(databaseName).build());\n            }\n            TableName table = TableName.valueOf(databaseName, tableName);\n            if (tableExists(table.getNameAsString())) {\n                log.info(\"Table {} already exists.\", table.getNameAsString());\n                if (!ignoreIfExists) {\n                    throw new HbaseConnectorException(\n                            HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION,\n                            HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION.getErrorMessage());\n                }\n                return;\n            }\n            TableDescriptorBuilder hbaseTableDescriptor = TableDescriptorBuilder.newBuilder(table);\n            columnFamilies.forEach(\n                    family ->\n                            hbaseTableDescriptor.setColumnFamily(\n                                    ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(family))\n                                            .build()));\n            admin.createTable(hbaseTableDescriptor.build());\n        } catch (IOException e) {\n            throw new HbaseConnectorException(\n                    HbaseConnectorErrorCode.TABLE_CREATE_EXCEPTION,\n                    HbaseConnectorErrorCode.TABLE_CREATE_EXCEPTION.getErrorMessage(),\n                    e);\n        }","sourceCodeStart":197,"sourceCodeEnd":233,"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#L197-L233","documentation":"In createTable(), if the target HBase table already exists and ignoreIfExists is false, HbaseConnectorException with TABLE_EXISTS_EXCEPTION is thrown (without a cause). This protects existing tables from being silently recreated or overwritten.","triggerScenarios":"Calling createTable() (or a schema-save catalog path) where TableName.valueOf(databaseName, tableName) already exists in HBase and ignoreIfExists=false.","commonSituations":"Re-running a job with auto-create enabled against an existing table without the ignore-exists flag; a previous failed run already created the table; table name collision between jobs.","solutions":["Set the ignore-exists / ignore-if-exists config option to true to skip existing tables","Drop the existing table first (e.g. via catalog.dropTable) if recreation is intended","Use a different table name if the existing data must be preserved","Check with tableExists() before calling createTable"],"exampleFix":"// before\nhbaseClient.createTable(databaseName, tableName, families, false);\n// after\nhbaseClient.createTable(databaseName, tableName, families, true); // or drop/verify beforehand","handlingStrategy":"validation","validationCode":"if (client.tableExists(TableName.valueOf(ns, table).getNameAsString()) && !ignoreIfExists) {\n    throw new IllegalStateException(\"Table \" + ns + \":\" + table + \" exists and ignoreIfExists=false\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.createTable(ns, table, families, ignoreIfExists);\n} catch (HbaseConnectorException e) {\n    if (e.getErrorCode() == HbaseConnectorErrorCode.TABLE_EXISTS_EXCEPTION) {\n        log.info(\"Table already exists; skipping creation\");\n    } else throw e;\n}","preventionTips":["Set the ignore-if-exists option when jobs may rerun against existing tables","Check tableExists() before createTable","Coordinate table naming between jobs to avoid collisions"],"tags":["hbase","table","exists","create"],"backgroundTag":"file-already-exists","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"}