apache/seatunnel · error · java.lang.UnsupportedOperationException

prepare method is not supported

Error message

prepare method is not supported

What it means

ExcelReadStrategy.getExcelEngine resolves the user-configured excel_engine option against the ExcelEngine enum by comparing, case-insensitively, both the enum name and its display name. When no enum value matches the configured string, it throws FileConnectorException with ILLEGAL_ARGUMENT. This is a configuration error: the connector only supports the engines defined in the ExcelEngine enum (e.g. POI, EasyExcel).

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/common/SeaTunnelPluginLifeCycle.java:43

 *
 * @deprecated SeaTunnel will not invoke prepare when init plugin, instead by {@link
 *     org.apache.seatunnel.api.table.factory.Factory}
 */
@Deprecated
public interface SeaTunnelPluginLifeCycle {

    /**
     * Use the pluginConfig to do some initialize operation.
     *
     * @param pluginConfig plugin config.
     * @throws PrepareFailException if plugin prepare failed, the {@link PrepareFailException} will
     *     throw.
     * @deprecated SeaTunnel will not invoke prepare when init plugin, instead by {@link
     *     org.apache.seatunnel.api.table.factory.Factory}
     */
    @Deprecated
    default void prepare(Config pluginConfig) throws PrepareFailException {
        throw new UnsupportedOperationException("prepare method is not supported");
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set excel_engine to a supported value: POI or EasyExcel (case-insensitive) in the source plugin config.
  2. Omit excel_engine entirely to use the option's default value.
  3. Check the ExcelEngine enum in connector-file-base to see the exact accepted names (name() and getExcelEngineName()).

Example fix

// before
plugin_config {
  excel_engine = "xlsx"
}
// after
plugin_config {
  excel_engine = "EasyExcel"
}
Defensive patterns

Strategy: validation

Validate before calling

java
Set<String> valid = Arrays.stream(ExcelEngine.values())
    .flatMap(e -> Stream.of(e.name(), e.getExcelEngineName()))
    .map(String::toLowerCase)
    .collect(Collectors.toSet());
if (!valid.contains(configuredEngine.toLowerCase())) {
    throw new IllegalArgumentException(
        "excel_engine must be one of " + valid + ", got: " + configuredEngine);
}

Try / catch

java
try {
    ExcelEngine engine = ExcelEngine.valueOf(configuredEngine.trim().toUpperCase());
} catch (FileConnectorException | IllegalArgumentException e) {
    LOG.error("Unsupported excel_engine '{}' — use POI or EasyExcel", configuredEngine, e);
}

Prevention

When it happens

Trigger: Calling getExcelEngine (indirectly via excelEngine or maxBytesForEntry during source reader setup) with a plugin_config excel_engine value that is not the name or display name of any ExcelEngine enum constant, e.g. excel_engine = "xlsx" or "poi-xssf".

Common situations: Typo in the config value (easyexel, poi ); copying an engine name from another library's docs; assuming the file extension (xlsx) is a valid engine name; config generated programmatically with a null or empty engine string.

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