{"record":{"id":"4c92a7ca0656c72b","repo":"apache/seatunnel","slug":"drop-collection-error","errorCode":"DROP_COLLECTION_ERROR","errorMessage":"DROP_COLLECTION_ERROR.getDescription()","messagePattern":"DROP_COLLECTION_ERROR\\.getDescription\\(\\)","errorType":"error_code","errorClass":"TypesenseConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-typesense/src/main/java/org/apache/seatunnel/connectors/seatunnel/typesense/client/TypesenseClient.java","lineNumber":248,"sourceCode":"        CollectionSchema collectionSchema = new CollectionSchema();\n        collectionSchema.name(collection).fields(fields).enableNestedFields(true);\n        try {\n            tsClient.collections().create(collectionSchema);\n            return true;\n        } catch (Exception e) {\n            log.error(CREATE_COLLECTION_ERROR.getDescription());\n            throw new TypesenseConnectorException(\n                    CREATE_COLLECTION_ERROR, CREATE_COLLECTION_ERROR.getDescription());\n        }\n    }\n\n    public boolean dropCollection(String collection) {\n        try {\n            tsClient.collections(collection).delete();\n            return true;\n        } catch (Exception e) {\n            log.error(DROP_COLLECTION_ERROR.getDescription());\n            throw new TypesenseConnectorException(\n                    DROP_COLLECTION_ERROR, DROP_COLLECTION_ERROR.getDescription());\n        }\n    }\n\n    public boolean truncateCollectionData(String collection) {\n        DeleteDocumentsParameters deleteDocumentsParameters = new DeleteDocumentsParameters();\n        deleteDocumentsParameters.filterBy(\"id:!=1||id:=1\");\n        try {\n            tsClient.collections(collection).documents().delete(deleteDocumentsParameters);\n        } catch (Exception e) {\n            log.error(TRUNCATE_COLLECTION_ERROR.getDescription());\n            throw new TypesenseConnectorException(\n                    TRUNCATE_COLLECTION_ERROR, TRUNCATE_COLLECTION_ERROR.getDescription());\n        }\n        return true;\n    }\n\n    public boolean deleteCollectionData(String collection, String id) {","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-typesense/src/main/java/org/apache/seatunnel/connectors/seatunnel/typesense/client/TypesenseClient.java#L230-L266","documentation":"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.","triggerScenarios":"Calling dropCollection(collection) when the collection does not exist, the API key lacks delete permission, or the Typesense node is unreachable/busy.","commonSituations":"Drop-table flows on a collection already removed by another job or manually; read-only API keys; cluster in maintenance/failover state.","solutions":["Check collectionExists(collection) first and skip the delete when absent (treat as idempotent)","Confirm the API key permits collection deletion (admin key)","Verify Typesense cluster health and retry on transient availability errors","Rethrow with the cause so the specific Typesense 404/403 is visible"],"exampleFix":"// before\npublic boolean dropCollection(String collection) {\n    tsClient.collections(collection).delete();\n    return true;\n}\n// after\npublic boolean dropCollection(String collection) {\n    if (!collectionExists(collection)) {\n        return true;\n    }\n    tsClient.collections(collection).delete();\n    return true;\n}","handlingStrategy":"validation","validationCode":"if (client.collectionExists(collection)) {\n    client.dropCollection(collection);\n} else {\n    // nothing to drop — treat drop as idempotent no-op\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.dropCollection(collection);\n} catch (TypesenseConnectorException e) {\n    // inspect cause: 404 means already gone (safe to ignore); 403 means permission issue\n}","preventionTips":["Treat drops as idempotent by checking existence first","Use admin keys for collection deletion","Verify cluster health before destructive operations"],"tags":["typesense","drop-collection","api-error"],"backgroundTag":"entity-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}