apache/seatunnel · error · FileConnectorException

SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED

SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED

Error message

When reading csv files, if user has not specified schema information, SeaTunnel will not support column projection

What it means

When no schema is specified, CsvReadStrategy.getSeaTunnelRowTypeInfo builds a simple default text schema and cannot honor column projection. If read_columns is configured together with the default schema, it throws FileConnectorException (CONFIG_VALIDATION_FAILED) because column projection is unsupported in that combination.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/CsvReadStrategy.java:249

        if (firstLineAsHeader && (!useSplitRead || split.getStart() == 0)) {
            headers = new ArrayList<>(csvParser.getHeaderNames());
        } else {
            headers =
                    inputCatalogTable.getTableSchema().getColumns().stream()
                            .map(Column::getName)
                            .collect(Collectors.toList());
        }
        return headers;
    }

    @Override
    public SeaTunnelRowType getSeaTunnelRowTypeInfo(String path) {
        this.seaTunnelRowType = CatalogTableUtil.buildSimpleTextSchema();
        this.seaTunnelRowTypeWithPartition =
                mergePartitionTypes(getPathForPartitionInference(path), seaTunnelRowType);
        initFormatter();
        if (pluginConfig.hasPath(FileBaseSourceOptions.READ_COLUMNS.key())) {
            throw new FileConnectorException(
                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
                    "When reading csv files, if user has not specified schema information, "
                            + "SeaTunnel will not support column projection");
        }
        CsvDeserializationSchema.Builder builder =
                CsvDeserializationSchema.builder()
                        .delimiter(getDelimiter())
                        .csvLineProcessor(processor)
                        .nullFormat(
                                readonlyConfig
                                        .getOptional(FileBaseSourceOptions.NULL_FORMAT)
                                        .orElse(null));
        if (isMergePartition) {
            deserializationSchema =
                    builder.seaTunnelRowType(this.seaTunnelRowTypeWithPartition).build();
        } else {
            deserializationSchema = builder.seaTunnelRowType(this.seaTunnelRowType).build();
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Remove the read_columns option when using the default CSV schema.
  2. Specify an explicit schema for the CSV source (e.g. via schema option/catalog table) so projection is supported, then keep read_columns.
  3. Use a transform (Filter/Sql) after the source to drop unwanted columns instead.

Example fix

// before (schema-less CSV)
read_columns = ["name", "age"]
// after
# remove read_columns, or declare a schema first:
schema = { fields { name = "string", age = "int" } }
read_columns = ["name", "age"]
Defensive patterns

Strategy: validation

Validate before calling

// Java
if (!hasExplicitSchema(config) && config.hasPath("read_columns")) {
    throw new IllegalArgumentException(
        "read_columns requires an explicit schema for CSV sources");
}

Prevention

When it happens

Trigger: Using a CSV file source without schema info (default built-in schema) while setting read_columns = ["a","b"] in the config — raised when the row type info is initialized.

Common situations: Users adding read_columns for performance on schema-less CSV sources; configs migrated from Parquet/JSON sources where projection works; not realizing schema must be declared for projection.

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/f16704638ddf2f72. Report an issue: GitHub.