apache/seatunnel · error · java.lang.IllegalArgumentException

Json parsing exception.

Error message

Json parsing exception.

What it means

ExcelReadStrategy.readByPoi opens a POI Workbook based on the current file's extension: .xls becomes HSSFWorkbook and .xlsx becomes XSSFWorkbook. Any other extension falls into the else branch and throws FileConnectorException with UNSUPPORTED_OPERATION, because the POI code path only knows how to read real Excel files.

Solutions

  1. Ensure every file matched by the source path has an .xls or .xlsx extension.
  2. Use the correct file_format for non-Excel files (e.g. text/csv connectors) instead of forcing them through the Excel reader.
  3. Rename the file to include a proper .xls/.xlsx extension if it is genuinely an Excel file.

Example fix

// before
path = "/data/export"   // contains export.csv, read with format=excel
// after
path = "/data/export/report.xlsx"   // point at actual .xlsx files
Defensive patterns

Strategy: validation

Validate before calling

java
String name = new File(path).getName().toLowerCase();
if (!name.endsWith(".xls") && !name.endsWith(".xlsx")) {
    throw new IllegalArgumentException("Excel reader requires .xls/.xlsx, got: " + name);
}

Type guard

java
static boolean isExcelFile(String path) {
    String n = path == null ? "" : path.toLowerCase();
    return n.endsWith(".xls") || n.endsWith(".xlsx");
}

Try / catch

java
try {
    reader.readProcess(split);
} catch (FileConnectorException e) {
    if (e.getMessage().contains("Only support read excel file")) {
        LOG.error("Path matched non-Excel file; fix path or file_format", e);
    }
}

Prevention

When it happens

Trigger: readByPoi (invoked from readProcess) is reached while currentFileName does not end with .xls or .xlsx — e.g. the discovery layer matched the file into an Excel source read but the file has a different or missing extension.

Common situations: Pointing a file source with format=excel at a .csv, .et, .xlsb, or extensionless file; files renamed without proper extension; a directory listing that mixes formats; uppercase or mixed-case extensions if the check is case-sensitive on the platform.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/ReadonlyConfig.java:61

    /** Stores the concrete key/value pairs of this configuration object. */
    protected final Map<String, Object> confData;

    private ReadonlyConfig(Map<String, Object> confData) {
        this.confData = confData;
    }

    public static ReadonlyConfig fromMap(Map<String, Object> map) {
        return new ReadonlyConfig(map);
    }

    public static ReadonlyConfig fromConfig(Config config) {
        try {
            return fromMap(
                    JACKSON_MAPPER.readValue(
                            config.root().render(ConfigRenderOptions.concise()),
                            new TypeReference<Map<String, Object>>() {}));
        } catch (JsonProcessingException e) {
            throw new IllegalArgumentException("Json parsing exception.", e);
        }
    }

    public <T> T get(Option<T> option) {
        return getOptional(option).orElseGet(option::defaultValue);
    }

    /**
     * Transform to Config todo: This method should be removed after we remove Config
     *
     * @return Config
     * @deprecated Please use ReadonlyConfig directly
     */
    @Deprecated
    public Config toConfig() {
        return ConfigFactory.parseMap(confData);
    }

View on GitHub (pinned to cf67b549a7)