apache/seatunnel · error · FileConnectorException

WRITER_OPERATION_FAILED

WRITER_OPERATION_FAILED

Error message

Abort transaction " + transactionId + " error, delete transaction directory failed

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/AbstractWriteStrategy.java:588

    /** abort prepare commit operation */
    @Override
    public void abortPrepare() {
        abortPrepare(transactionId);
    }

    /**
     * abort prepare commit operation using transaction directory
     *
     * @param transactionId transaction id
     */
    public void abortPrepare(String transactionId) {
        String transactionDir = getTransactionDir(transactionId);
        try {
            hadoopFileSystemProxy.deleteFile(transactionDir);
            cleanupTransactionParentDirectories(transactionDir);
        } catch (IOException e) {
            throw new FileConnectorException(
                    CommonErrorCodeDeprecated.WRITER_OPERATION_FAILED,
                    "Abort transaction "
                            + transactionId
                            + " error, delete transaction directory failed",
                    e);
        }
    }

    private void cleanupTransactionParentDirectories(String transactionDir) {
        Path uuidDir = new Path(transactionDir).getParent();
        if (uuidDir == null) {
            return;
        }
        Path jobDir = uuidDir.getParent();
        if (jobDir == null) {
            return;
        }
        cleanupEmptyDirectory(uuidDir);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the wrapped IOException cause for the root filesystem error (connectivity, permission, path) and fix that
  2. Verify the storage is reachable and the sink user has delete permissions on the transaction directory
  3. Manually clean stale transaction directories under the sink path, then retry the failed job

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// before the job runs: verify delete permission on the transaction dir layout
try (FileSystem fs = FileSystem.get(conf)) {
  Path probe = new Path(sinkPath, ".staging/probe");
  fs.mkdirs(probe); fs.delete(probe, true); // throws if deletion would fail
}

Try / catch

try { sink.abortPrepare(txId); } catch (FileConnectorException e) {
  if (e.getCode() == CommonErrorCode.WRITER_OPERATION_FAILED) {
    log.warn("Abort cleanup failed, will retry / clean stale dir manually: {}", e.getMessage());
  }
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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