{"record":{"id":"9167de57e0c7ad35","repo":"apache/seatunnel","slug":"writer-operation-failed-9167de","errorCode":"WRITER_OPERATION_FAILED","errorMessage":"Abort transaction \" + transactionId + \" error, delete transaction directory failed","messagePattern":"Abort transaction \" \\+ transactionId \\+ \" error, delete transaction directory failed","errorType":"error_code","errorClass":"FileConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/AbstractWriteStrategy.java","lineNumber":588,"sourceCode":"\n    /** abort prepare commit operation */\n    @Override\n    public void abortPrepare() {\n        abortPrepare(transactionId);\n    }\n\n    /**\n     * abort prepare commit operation using transaction directory\n     *\n     * @param transactionId transaction id\n     */\n    public void abortPrepare(String transactionId) {\n        String transactionDir = getTransactionDir(transactionId);\n        try {\n            hadoopFileSystemProxy.deleteFile(transactionDir);\n            cleanupTransactionParentDirectories(transactionDir);\n        } catch (IOException e) {\n            throw new FileConnectorException(\n                    CommonErrorCodeDeprecated.WRITER_OPERATION_FAILED,\n                    \"Abort transaction \"\n                            + transactionId\n                            + \" error, delete transaction directory failed\",\n                    e);\n        }\n    }\n\n    private void cleanupTransactionParentDirectories(String transactionDir) {\n        Path uuidDir = new Path(transactionDir).getParent();\n        if (uuidDir == null) {\n            return;\n        }\n        Path jobDir = uuidDir.getParent();\n        if (jobDir == null) {\n            return;\n        }\n        cleanupEmptyDirectory(uuidDir);","sourceCodeStart":570,"sourceCodeEnd":606,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/AbstractWriteStrategy.java#L570-L606","documentation":"When a transaction is aborted, abortPrepare deletes the transaction directory on the target filesystem. If hadoopFileSystemProxy.deleteFile throws IOException, the abort cannot complete and a FileConnectorException with code WRITER_OPERATION_FAILED is thrown. This leaves transaction state on disk and signals that the two-phase-commit cleanup itself failed.","triggerScenarios":"abortPrepare(transactionId) is invoked during prepare-fail, job cancel, or failure recovery, and the underlying Hadoop filesystem delete of the transaction directory fails (I/O error, network hiccup to HDFS/S3, permissions, or directory already removed).","commonSituations":"HDFS NameNode or S3 endpoint temporarily unreachable during abort; the transaction directory was concurrently deleted; IAM/HDFS permissions deny deletion of the pending-transaction directory.","solutions":["Check the wrapped IOException cause for the root filesystem error (connectivity, permission, path) and fix that","Verify the storage is reachable and the sink user has delete permissions on the transaction directory","Manually clean stale transaction directories under the sink path, then retry the failed job"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// before the job runs: verify delete permission on the transaction dir layout\ntry (FileSystem fs = FileSystem.get(conf)) {\n  Path probe = new Path(sinkPath, \".staging/probe\");\n  fs.mkdirs(probe); fs.delete(probe, true); // throws if deletion would fail\n}","typeGuard":null,"tryCatchPattern":"try { sink.abortPrepare(txId); } catch (FileConnectorException e) {\n  if (e.getCode() == CommonErrorCode.WRITER_OPERATION_FAILED) {\n    log.warn(\"Abort cleanup failed, will retry / clean stale dir manually: {}\", e.getMessage());\n  }\n}","preventionTips":["Ensure the sink user has delete permissions on the transaction-directory parent","Monitor storage connectivity; transient HDFS/S3 outages break abort cleanup","Schedule cleanup of leftover transaction directories after job failures"],"tags":["file-sink","filesystem","io","two-phase-commit"],"backgroundTag":"file-write-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}