{"record":{"id":"e40d20e82d508453","repo":"apache/seatunnel","slug":"format-not-support-e40d20","errorCode":"FORMAT_NOT_SUPPORT","errorMessage":"BinaryWriteStrategy does not support generating empty files when no data is written.","messagePattern":"BinaryWriteStrategy does not support generating empty files when no data is written\\.","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/BinaryWriteStrategy.java","lineNumber":49,"sourceCode":"import org.apache.hadoop.fs.FSDataOutputStream;\n\nimport lombok.NonNull;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.LinkedHashMap;\n\npublic class BinaryWriteStrategy extends AbstractWriteStrategy<FSDataOutputStream> {\n\n    private final LinkedHashMap<String, FSDataOutputStream> beingWrittenOutputStream;\n    private final LinkedHashMap<String, Long> partIndexMap;\n\n    public BinaryWriteStrategy(FileSinkConfig fileSinkConfig) {\n        super(fileSinkConfig);\n        this.beingWrittenOutputStream = new LinkedHashMap<>();\n        this.partIndexMap = new LinkedHashMap<>();\n        if (fileSinkConfig.isCreateEmptyFileWhenNoData()) {\n            throw new FileConnectorException(\n                    FileConnectorErrorCode.FORMAT_NOT_SUPPORT,\n                    \"BinaryWriteStrategy does not support generating empty files when no data is written.\");\n        }\n    }\n\n    @Override\n    public void setCatalogTable(CatalogTable catalogTable) {\n        super.setCatalogTable(catalogTable);\n        if (!catalogTable.getSeaTunnelRowType().equals(BinaryReadStrategy.binaryRowType)) {\n            throw new FileConnectorException(\n                    FileConnectorErrorCode.FORMAT_NOT_SUPPORT,\n                    \"BinaryWriteStrategy only supports binary format, please read file with `BINARY` format, and do not change schema in the transform.\");\n        }\n    }\n\n    @Override\n    public void write(SeaTunnelRow seaTunnelRow) throws FileConnectorException {\n        long partIndex = (long) seaTunnelRow.getField(2);","sourceCodeStart":31,"sourceCodeEnd":67,"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/BinaryWriteStrategy.java#L31-L67","documentation":"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.","triggerScenarios":"Constructing BinaryWriteStrategy with FileSinkConfig.isCreateEmptyFileWhenNoData() == true, i.e. sink config create_empty_file_when_no_data = true combined with file_format_type = \"binary\".","commonSituations":"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.","solutions":["Set create_empty_file_when_no_data = false in the sink config","Or switch file_format_type to a format that supports empty files (e.g. text, parquet) if binary is not required","If empty-output detection matters, handle it downstream instead of relying on placeholder binary files"],"exampleFix":"// before\nsink {\n  LocalFile {\n    file_format_type = \"binary\"\n    create_empty_file_when_no_data = true\n  }\n}\n// after\nsink {\n  LocalFile {\n    file_format_type = \"binary\"\n    create_empty_file_when_no_data = false\n  }\n}","handlingStrategy":"validation","validationCode":"// before submitting\nif (\"binary\".equals(sinkConfig.fileFormatType) && Boolean.TRUE.equals(sinkConfig.createEmptyFileWhenNoData)) {\n  throw new IllegalArgumentException(\"create_empty_file_when_no_data is not supported by binary format\");\n}","typeGuard":null,"tryCatchPattern":"try { new BinaryWriteStrategy(fileSinkConfig); } catch (FileConnectorException e) { if (e.getCode() == FileConnectorErrorCode.FORMAT_NOT_SUPPORT) { /* disable create_empty_file_when_no_data */ } }","preventionTips":["Never enable create_empty_file_when_no_data with file_format_type=binary","When copying sink configs between formats, re-check format-specific options","Read the format compatibility matrix before mixing options"],"tags":["file-sink","binary","config-conflict"],"backgroundTag":"conflicting-config-options","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"}