apache/seatunnel · error · TypesenseConnectorException
TRUNCATE_COLLECTION_ERROR
TRUNCATE_COLLECTION_ERROR
Error message
TRUNCATE_COLLECTION_ERROR.getDescription()
What it means
TypesenseClient.truncateCollectionData() empties a collection by deleting all documents using a filter 'id:!=1||id:=1'; failures from the bulk delete API are rethrown as TypesenseConnectorException with TRUNCATE_COLLECTION_ERROR.
Solutions
- Verify the collection exists before truncating; create it if the 404 is expected in your flow
- Ensure the API key has document-delete permissions
- Confirm the Typesense server version supports filter_by-based bulk document deletion
- Attach the original exception when rethrowing to see Typesense's precise error
Example fix
// before
} catch (Exception e) {
log.error(TRUNCATE_COLLECTION_ERROR.getDescription());
throw new TypesenseConnectorException(TRUNCATE_COLLECTION_ERROR, TRUNCATE_COLLECTION_ERROR.getDescription());
}
// after
} catch (Exception e) {
log.error(TRUNCATE_COLLECTION_ERROR.getDescription(), e);
throw new TypesenseConnectorException(TRUNCATE_COLLECTION_ERROR, TRUNCATE_COLLECTION_ERROR.getDescription(), e);
} Defensive patterns
Strategy: retry
Validate before calling
if (!client.collectionExists(collection)) {
throw new IllegalStateException("Cannot truncate non-existent collection: " + collection);
} Try / catch
try {
client.truncateCollectionData(collection);
} catch (TypesenseConnectorException e) {
// bounded exponential-backoff retry; verify collection exists and key permissions
} Prevention
- Check collection existence before truncation
- Ensure delete permission on documents for the API key
- Confirm server version supports filter_by bulk delete
- Retry transient failures; avoid truncating collections other jobs may be writing to
When it happens
Trigger: Calling truncateCollectionData(collection) when the collection no longer exists (404 on the documents endpoint), the API key cannot delete documents, or the delete filter is rejected by the Typesense version in use.
Common situations: Truncate/overwrite write modes on a collection dropped concurrently; older Typesense servers that don't support the filter_by delete syntax; permission-restricted keys.
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/561f32b57f698418.
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:260
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) {
try {
tsClient.collections(collection).documents(id).delete();
} catch (Exception e) {
log.error(DELETE_COLLECTION_ERROR.getDescription());
throw new TypesenseConnectorException(
DELETE_COLLECTION_ERROR, DELETE_COLLECTION_ERROR.getDescription());
}
return true;
}
public long collectionDocNum(String collection) {
SearchParameters q = new SearchParameters().q("*");View on GitHub (pinned to cf67b549a7)