apache/seatunnel · error · FileConnectorException

FORMAT_NOT_SUPPORT

FORMAT_NOT_SUPPORT

Error message

BinaryWriteStrategy does not support generating empty files when no data is written.

What it means

BinaryWriteStrategy cannot produce placeholder (empty) files when a sink task writes no data. The config option create_empty_file_when_no_data requests such empty files, and the binary writer rejects it in its constructor with FORMAT_NOT_SUPPORT because binary files have no meaningful empty representation for downstream BINARY-format readers.

Source

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

import org.apache.hadoop.fs.FSDataOutputStream;

import lombok.NonNull;

import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;

public class BinaryWriteStrategy extends AbstractWriteStrategy<FSDataOutputStream> {

    private final LinkedHashMap<String, FSDataOutputStream> beingWrittenOutputStream;
    private final LinkedHashMap<String, Long> partIndexMap;

    public BinaryWriteStrategy(FileSinkConfig fileSinkConfig) {
        super(fileSinkConfig);
        this.beingWrittenOutputStream = new LinkedHashMap<>();
        this.partIndexMap = new LinkedHashMap<>();
        if (fileSinkConfig.isCreateEmptyFileWhenNoData()) {
            throw new FileConnectorException(
                    FileConnectorErrorCode.FORMAT_NOT_SUPPORT,
                    "BinaryWriteStrategy does not support generating empty files when no data is written.");
        }
    }

    @Override
    public void setCatalogTable(CatalogTable catalogTable) {
        super.setCatalogTable(catalogTable);
        if (!catalogTable.getSeaTunnelRowType().equals(BinaryReadStrategy.binaryRowType)) {
            throw new FileConnectorException(
                    FileConnectorErrorCode.FORMAT_NOT_SUPPORT,
                    "BinaryWriteStrategy only supports binary format, please read file with `BINARY` format, and do not change schema in the transform.");
        }
    }

    @Override
    public void write(SeaTunnelRow seaTunnelRow) throws FileConnectorException {
        long partIndex = (long) seaTunnelRow.getField(2);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set create_empty_file_when_no_data = false in the sink config
  2. Or switch file_format_type to a format that supports empty files (e.g. text, parquet) if binary is not required
  3. If empty-output detection matters, handle it downstream instead of relying on placeholder binary files

Example fix

// before
sink {
  LocalFile {
    file_format_type = "binary"
    create_empty_file_when_no_data = true
  }
}
// after
sink {
  LocalFile {
    file_format_type = "binary"
    create_empty_file_when_no_data = false
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// before submitting
if ("binary".equals(sinkConfig.fileFormatType) && Boolean.TRUE.equals(sinkConfig.createEmptyFileWhenNoData)) {
  throw new IllegalArgumentException("create_empty_file_when_no_data is not supported by binary format");
}

Try / catch

try { new BinaryWriteStrategy(fileSinkConfig); } catch (FileConnectorException e) { if (e.getCode() == FileConnectorErrorCode.FORMAT_NOT_SUPPORT) { /* disable create_empty_file_when_no_data */ } }

Prevention

When it happens

Trigger: Constructing BinaryWriteStrategy with FileSinkConfig.isCreateEmptyFileWhenNoData() == true, i.e. sink config create_empty_file_when_no_data = true combined with file_format_type = "binary".

Common situations: User wants consistent output even for empty partitions/sources and enables the empty-file option, not realizing it conflicts with binary format; copying a config written for text/parquet sinks to a binary sink.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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