{"record":{"id":"fe75fb6d3d8d5e01","repo":"apache/seatunnel","slug":"table-tablepath-already-exists-in-catalog-hive","errorCode":null,"errorMessage":"Table ${tablePath} already exists in catalog hive","messagePattern":"Table (.+?) already exists in catalog hive","errorType":"exception","errorClass":"TableAlreadyExistException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java","lineNumber":634,"sourceCode":"            return convertHiveTableToCatalogTable(hiveTable);\n        } catch (TableNotExistException e) {\n            throw e;\n        } catch (HiveConnectorException e) {\n            throw new CatalogException(\"Failed to get table: \" + tablePath, e);\n        }\n    }\n\n    @Override\n    public void createTable(TablePath tablePath, CatalogTable table, boolean ignoreIfExists)\n            throws TableAlreadyExistException, DatabaseNotExistException, CatalogException {\n        try {\n            if (!databaseExists(tablePath.getDatabaseName())) {\n                throw new DatabaseNotExistException(\"hive\", tablePath.getDatabaseName());\n            }\n\n            if (tableExists(tablePath.getDatabaseName(), tablePath.getTableName())) {\n                if (!ignoreIfExists) {\n                    throw new TableAlreadyExistException(\"hive\", tablePath);\n                }\n                return;\n            }\n\n            Table hiveTable = convertCatalogTableToHiveTable(tablePath, table);\n            createTableIfNotExists(hiveTable);\n        } catch (TableAlreadyExistException | DatabaseNotExistException | CatalogException e) {\n            throw e;\n        } catch (HiveConnectorException e) {\n            throw new CatalogException(\"Failed to create table: \" + tablePath, e);\n        } catch (TException e) {\n            throw new CatalogException(\"Failed to create table: \" + tablePath, e);\n        }\n    }\n\n    @Override\n    public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)\n            throws TableNotExistException, CatalogException {","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hive/src/main/java/org/apache/seatunnel/connectors/seatunnel/hive/utils/HiveMetaStoreCatalog.java#L616-L652","documentation":"This error is raised by HiveMetaStoreCatalog.createTable when it attempts to create a table that already exists in the Hive Metastore and ignoreIfExists is false. It fires when a job or save-mode action tries to create a table whose metadata is already present in the target database; setting ignoreIfExists=true suppresses it, otherwise the caller must drop the table or pick a new name.","triggerScenarios":"Calling createTable(tablePath, table, false) for a table that already exists; re-running a job that creates tables without idempotency settings.","commonSituations":"Job restarts re-running DDL; concurrent pipelines writing the same table; forgetting to set ignoreIfExists=true for idempotent pipelines; leftover table from a previous failed run.","solutions":["Pass ignoreIfExists=true if re-creating should be a no-op.","Drop the existing table first (catalog.dropTable(tablePath, true)) if replacement is intended.","Use a different table name or partition scheme for the new run.","Guard with catalog.tableExists(tablePath) before creating."],"exampleFix":"// before\ncatalog.createTable(tablePath, table, false); // fails on rerun\n// after\ncatalog.createTable(tablePath, table, true); // idempotent","handlingStrategy":"validation","validationCode":"boolean exists = catalog.tableExists(tablePath);\ncatalog.createTable(tablePath, table, exists ? true : false); // or explicit policy","typeGuard":null,"tryCatchPattern":"try {\n    catalog.createTable(tablePath, table, false);\n} catch (TableAlreadyExistException e) {\n    // acceptable for idempotent re-runs; or drop and recreate deliberately\n}","preventionTips":["Set ignoreIfExists=true for restartable/idempotent pipelines.","Drop stale tables from failed runs before recreating.","Avoid concurrent jobs creating the same table name."],"tags":["hive","catalog","table-already-exists","idempotency"],"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-14T05:17:10.506Z"}