apache/seatunnel · error · java.lang.IllegalArgumentException

Operator %s requires an expectValue, but expectValue is null

Error message

Operator %s requires an expectValue, but expectValue is null

What it means

ExcelReadStrategy.getSeaTunnelRowTypeInfo unconditionally throws FileConnectorException with UNSUPPORTED_OPERATION: the Excel reader never infers a schema from the file. (The message text mentions 'json file type' — a copy-over from another reader — but the semantics are that Excel sources require a user-defined schema.) Callers must supply the schema via the config/CatalogTable instead of asking the reader to discover it.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/Condition.java:69

            T expectValue,
            Option<?> compareOption,
            ConditionExtension<T> extension) {
        if (option == null) {
            throw new IllegalArgumentException("Condition option must not be null");
        }
        if (operator == null) {
            throw new IllegalArgumentException("Condition operator must not be null");
        }
        if (operator.getSource() == ConditionOperator.Source.FIELD && compareOption == null) {
            throw new IllegalArgumentException(
                    String.format(
                            "Operator %s requires a compareOption (cross-field comparison), but compareOption is null",
                            operator.name()));
        }
        if (operator.getArity() == ConditionOperator.Arity.BINARY
                && operator.getSource() == ConditionOperator.Source.LITERAL
                && expectValue == null) {
            throw new IllegalArgumentException(
                    String.format(
                            "Operator %s requires an expectValue, but expectValue is null",
                            operator.name()));
        }
        if (operator == ConditionOperator.EXTENSION && extension == null) {
            throw new IllegalArgumentException(
                    "Operator EXTENSION requires a non-null ConditionExtension");
        }
        this.option = option;
        this.operator = operator;
        this.expectValue = expectValue;
        this.compareOption = compareOption;
        this.extension = extension;
    }

    public static <T> Condition<T> of(Option<T> option, T expectValue) {
        return new Condition<>(option, expectValue);
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Define the schema explicitly in the Excel source configuration (schema with field names and types) so schema inference is never attempted.
  2. Do not call getSeaTunnelRowTypeInfo for Excel sources; obtain the row type from the user-defined CatalogTable instead.
  3. If you own the calling code, branch on the read strategy type and skip inference for Excel.

Example fix

// before
SeaTunnelRowType rowType = reader.getSeaTunnelRowTypeInfo(path); // always throws for Excel
// after
// declare schema in the source config and use the user-defined row type
SeaTunnelRowType rowType = userDefinedRowTypeWithPartition;
Defensive patterns

Strategy: type-guard

Validate before calling

java
// Do not call schema inference for Excel sources; require user-defined schema first
if (strategy instanceof ExcelReadStrategy && userDefinedRowType == null) {
    throw new IllegalArgumentException("Excel source requires user-defined schema (config schema block)");
}

Type guard

java
if (strategy instanceof ExcelReadStrategy) {
    // never call getSeaTunnelRowTypeInfo; use the user-defined row type
    SeaTunnelRowType rowType = userDefinedRowType;
}

Try / catch

java
try {
    rowType = strategy.getSeaTunnelRowTypeInfo(path);
} catch (FileConnectorException e) {
    rowType = userDefinedRowType; // Excel always requires user-defined schema
}

Prevention

When it happens

Trigger: Any call to getSeaTunnelRowTypeInfo(path) on the Excel read strategy — e.g. generic file-source code that tries to auto-derive a row type from the file path without a user-defined schema.

Common situations: Reusing a generic reader pipeline that calls schema inference for all formats; migrating a job from a format with schema inference (like CSV/JSON inference paths) to Excel; missing the schema block in the Excel source config.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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