apache/seatunnel · error · TableNotExistException
Table ${tablePath} does not exist in catalog ${name()}
Error message
Table ${tablePath} does not exist in catalog ${name()} What it means
This error is raised by MongodbCatalog.dropTable when the requested collection does not exist and ignoreIfNotExists is false. It fires when a drop-table operation targets a database or collection name that has no corresponding collection in MongoDB, typically due to a misspelled collection name, wrong database, or a collection already dropped by a concurrent job; pass ignoreIfNotExists=true to make the drop a no-op instead.
Source
Thrown at seatunnel-connectors-v2/connector-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/catalog/MongodbCatalog.java:149
if (tableExists(tablePath)) {
if (ignoreIfExists) return;
throw new TableAlreadyExistException(name(), tablePath);
}
try {
MongoDatabase db = mongoClient.getDatabase(tablePath.getDatabaseName());
db.createCollection(tablePath.getTableName());
} catch (Exception e) {
throw new CatalogException(
"Failed to create collection: " + tablePath.getFullName(), e);
}
}
@Override
public void dropTable(TablePath tablePath, boolean ignoreIfNotExists)
throws TableNotExistException, CatalogException {
if (!tableExists(tablePath)) {
if (ignoreIfNotExists) return;
throw new TableNotExistException(name(), tablePath);
}
try {
MongoDatabase db = mongoClient.getDatabase(tablePath.getDatabaseName());
db.getCollection(tablePath.getTableName()).drop();
} catch (Exception e) {
throw new CatalogException("Failed to drop collection: " + tablePath.getFullName(), e);
}
}
@Override
public void createDatabase(TablePath tablePath, boolean ignoreIfExists)
throws DatabaseAlreadyExistException, CatalogException {
throw CommonError.unsupportedOperation(name(), "create database ");
}
@Override
public void dropDatabase(TablePath tablePath, boolean ignoreIfNotExists)
throws DatabaseNotExistException, CatalogException {View on GitHub (pinned to cf67b549a7)
Solutions
- Pass ignoreIfNotExists=true to make dropping a missing collection a no-op.
- Check catalog.tableExists(tablePath) before dropping.
- Verify the table path (database and collection names) matches the target environment.
- If it must exist, investigate why it is missing before dropping (was it dropped already?).
Example fix
// before catalog.dropTable(tablePath, false); // after catalog.dropTable(tablePath, true); // idempotent drop
Defensive patterns
Strategy: validation
Validate before calling
if (!catalog.tableExists(tablePath)) {
return; // nothing to drop
} Try / catch
try {
catalog.dropTable(tablePath, false);
} catch (TableNotExistException e) {
// expected on idempotent cleanup; ignore or log
} Prevention
- Use ignoreIfNotExists=true for cleanup scripts
- Check tableExists before destructive operations
- Verify environment-specific table paths
When it happens
Trigger: Calling dropTable on a (database, collection) that does not exist with ignoreIfNotExists=false; typo in the table path; the collection was already dropped by a previous run or another process.
Common situations: Cleanup scripts running twice, wrong environment (dropping in prod vs dev name), case mismatch in the collection name.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- TableNotExistException: catalogName, tablePath
- Table ${tablePath} does not exist in catalog hive
- Table 'TablePath{databaseName='null', schemaName='null', tab
- Failed to open MongoDB Catalog: ${e.getMessage()}
- Failed to check database existence: ${databaseName}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/9ec817ddd5884c35.
Report an issue: GitHub.