apache/seatunnel · error · FileConnectorException

ILLEGAL_ARGUMENT

ILLEGAL_ARGUMENT

Error message

File sink connector not support this file type [%s], please check your config

What it means

WriteStrategyFactory.of(FileSinkConfig, fileType) resolves a WriteStrategy from the FileFormat enum via fileFormat.getWriteStrategy(fileSinkConfig). FileFormat.getWriteStrategy throws IllegalArgumentException for formats without a sink strategy, and the factory wraps it as FileConnectorException with ILLEGAL_ARGUMENT, telling the user the configured file type is not supported by the file sink. This is a configuration-time validation error.

Source

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

import org.apache.seatunnel.connectors.seatunnel.file.sink.config.FileSinkConfig;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class WriteStrategyFactory {

    private WriteStrategyFactory() {}

    public static WriteStrategy of(String fileType, FileSinkConfig fileSinkConfig) {
        try {
            FileFormat fileFormat = FileFormat.valueOf(fileType.toUpperCase());
            return fileFormat.getWriteStrategy(fileSinkConfig);
        } catch (IllegalArgumentException e) {
            String errorMsg =
                    String.format(
                            "File sink connector not support this file type [%s], please check your config",
                            fileType);
            throw new FileConnectorException(CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT, errorMsg);
        }
    }

    public static WriteStrategy of(FileFormat fileFormat, FileSinkConfig fileSinkConfig) {
        return fileFormat.getWriteStrategy(fileSinkConfig);
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check the configured file_format value and use a sink-supported format: text, csv, parquet, orc, json
  2. Fix typos or stray whitespace in the file_format config key/value
  3. Consult FileFormat.getWriteStrategy to confirm which formats have write strategies in your version
  4. If you need a custom format, register it in FileFormat with a WriteStrategy implementation

Example fix

// before
sink {
  File {
    file_format = "lzo"   // no sink strategy
  }
}
// after
sink {
  File {
    file_format = "parquet"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

if (!Set.of("text","csv","parquet","orc","json").contains(config.getString("file_format").toLowerCase().trim())) throw new ConfigException("unsupported sink file_format");

Try / catch

try { WriteStrategyFactory.of(fileSinkConfig, fileType); } catch (FileConnectorException e) { if (e.getMessage().contains("not support this file type")) { /* fix file_format in config */ } }

Prevention

When it happens

Trigger: Setting sink file_format/type to a format that has no write strategy (e.g. formats only supported for reading, or a typo'd/unregistered value) when the sink plugin initializes.

Common situations: Typo in file_format config (e.g. 'parquet ' with whitespace or wrong case handled upstream); using a read-only format for a sink; copying a source config to a sink; custom format plugin registered for source only; version where the format's write strategy was not yet implemented.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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