{"record":{"id":"155d417d08536f54","repo":"apache/seatunnel","slug":"tablealreadyexistexception-catalogname-tablepath","errorCode":null,"errorMessage":"TableAlreadyExistException: catalogName, tablePath","messagePattern":"TableAlreadyExistException: catalogName, tablePath","errorType":"error_code","errorClass":"TableAlreadyExistException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java","lineNumber":305,"sourceCode":"    }\n\n    @Override\n    public void createTable(TablePath tablePath, CatalogTable table, boolean ignoreIfExists)\n            throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {\n        checkOpen();\n\n        String databaseName = tablePath.getDatabaseName();\n        String tableName = tablePath.getTableName();\n\n        if (!databaseExists(databaseName)) {\n            throw new DatabaseNotExistException(catalogName, databaseName);\n        }\n\n        if (tableExists(tablePath)) {\n            if (ignoreIfExists) {\n                return;\n            }\n            throw new TableAlreadyExistException(catalogName, tablePath);\n        }\n\n        String createTableSql =\n                buildCreateTableSql(databaseName, tableName, table.getTableSchema());\n\n        try (Connection connection = getConnection();\n                Statement statement = connection.createStatement()) {\n            statement.execute(createTableSql);\n        } catch (SQLException e) {\n            throw new DatabendConnectorException(\n                    DatabendConnectorErrorCode.SQL_OPERATION_FAILED,\n                    \"Failed to create table: \" + e.getMessage(),\n                    e);\n        }\n    }\n\n    @Override\n    public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/catalog/DatabendCatalog.java#L287-L323","documentation":"createTable() throws the standard SeaTunnel TableAlreadyExistException when the target table already exists in Databend and ignoreIfExists is false. This is a pre-check the catalog performs before issuing CREATE TABLE.","triggerScenarios":"Calling createTable(tablePath, table, false) when tableExists(tablePath) is true — the table was already created by a previous run or another process.","commonSituations":"Re-running a batch job without cleanup; concurrent jobs creating the same table; intentionally idempotent runs that forgot to pass ignoreIfExists=true.","solutions":["Pass ignoreIfExists=true if re-running should skip existing tables.","Drop the existing table first (catalog.dropTable(tablePath, false)) if it should be recreated.","Use a different table name/ TablePath for the new run."],"exampleFix":"// before\ncatalog.createTable(tablePath, table, false); // throws on re-run\n// after\ncatalog.createTable(tablePath, table, true); // idempotent re-run","handlingStrategy":"validation","validationCode":"if (catalog.tableExists(tablePath)) { /* skip or drop first */ } else { catalog.createTable(tablePath, table, false); }","typeGuard":null,"tryCatchPattern":"try { catalog.createTable(tablePath, table, false); } catch (TableAlreadyExistException e) { log.warn(\"Table {} already exists, skipping\", tablePath); }","preventionTips":["Pass ignoreIfExists=true for idempotent pipelines","Drop/rename stale tables before re-running","Avoid concurrent jobs writing the same table name"],"tags":["table-already-exist","databend","catalog","create-table"],"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-14T11:17:12.474Z"}