apache/seatunnel · error · TypesenseConnectorException

DROP_COLLECTION_ERROR

DROP_COLLECTION_ERROR

Error message

DROP_COLLECTION_ERROR.getDescription()

What it means

TypesenseClient.dropCollection() deletes a collection via the Typesense API; any failure (including the collection not existing, which yields 404) is rethrown as TypesenseConnectorException with DROP_COLLECTION_ERROR.

Solutions

  1. Check collectionExists(collection) first and skip the delete when absent (treat as idempotent)
  2. Confirm the API key permits collection deletion (admin key)
  3. Verify Typesense cluster health and retry on transient availability errors
  4. Rethrow with the cause so the specific Typesense 404/403 is visible

Example fix

// before
public boolean dropCollection(String collection) {
    tsClient.collections(collection).delete();
    return true;
}
// after
public boolean dropCollection(String collection) {
    if (!collectionExists(collection)) {
        return true;
    }
    tsClient.collections(collection).delete();
    return true;
}
Defensive patterns

Strategy: validation

Validate before calling

if (client.collectionExists(collection)) {
    client.dropCollection(collection);
} else {
    // nothing to drop — treat drop as idempotent no-op
}

Try / catch

try {
    client.dropCollection(collection);
} catch (TypesenseConnectorException e) {
    // inspect cause: 404 means already gone (safe to ignore); 403 means permission issue
}

Prevention

When it happens

Trigger: Calling dropCollection(collection) when the collection does not exist, the API key lacks delete permission, or the Typesense node is unreachable/busy.

Common situations: Drop-table flows on a collection already removed by another job or manually; read-only API keys; cluster in maintenance/failover state.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/4c92a7ca0656c72b. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-typesense/src/main/java/org/apache/seatunnel/connectors/seatunnel/typesense/client/TypesenseClient.java:248

        CollectionSchema collectionSchema = new CollectionSchema();
        collectionSchema.name(collection).fields(fields).enableNestedFields(true);
        try {
            tsClient.collections().create(collectionSchema);
            return true;
        } catch (Exception e) {
            log.error(CREATE_COLLECTION_ERROR.getDescription());
            throw new TypesenseConnectorException(
                    CREATE_COLLECTION_ERROR, CREATE_COLLECTION_ERROR.getDescription());
        }
    }

    public boolean dropCollection(String collection) {
        try {
            tsClient.collections(collection).delete();
            return true;
        } catch (Exception e) {
            log.error(DROP_COLLECTION_ERROR.getDescription());
            throw new TypesenseConnectorException(
                    DROP_COLLECTION_ERROR, DROP_COLLECTION_ERROR.getDescription());
        }
    }

    public boolean truncateCollectionData(String collection) {
        DeleteDocumentsParameters deleteDocumentsParameters = new DeleteDocumentsParameters();
        deleteDocumentsParameters.filterBy("id:!=1||id:=1");
        try {
            tsClient.collections(collection).documents().delete(deleteDocumentsParameters);
        } catch (Exception e) {
            log.error(TRUNCATE_COLLECTION_ERROR.getDescription());
            throw new TypesenseConnectorException(
                    TRUNCATE_COLLECTION_ERROR, TRUNCATE_COLLECTION_ERROR.getDescription());
        }
        return true;
    }

    public boolean deleteCollectionData(String collection, String id) {

View on GitHub (pinned to cf67b549a7)