apache/seatunnel · error · UnsupportedOperationException

File format 'maxwell_json' does not support reading.

Error message

File format 'maxwell_json' does not support reading.

What it means

The MAXWELL_JSON FileFormat enum member only supports writing (MaxWellJsonWriteStrategy). Calling getReadStrategy() throws UnsupportedOperationException because maxwell_json cannot be used as a file source format.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/FileFormat.java:172

        public WriteStrategy getWriteStrategy(FileSinkConfig fileSinkConfig) {
            return new DebeziumJsonWriteStrategy(fileSinkConfig);
        }

        @Override
        public ReadStrategy getReadStrategy() {
            throw new UnsupportedOperationException(
                    "File format 'debezium_json' does not support reading.");
        }
    },
    MAXWELL_JSON("maxwell_json") {
        @Override
        public WriteStrategy getWriteStrategy(FileSinkConfig fileSinkConfig) {
            return new MaxWellJsonWriteStrategy(fileSinkConfig);
        }

        @Override
        public ReadStrategy getReadStrategy() {
            throw new UnsupportedOperationException(
                    "File format 'maxwell_json' does not support reading.");
        }
    },
    MARKDOWN("md", "markdown") {
        @Override
        public WriteStrategy getWriteStrategy(FileSinkConfig fileSinkConfig) {
            throw new UnsupportedOperationException(
                    "File format 'markdown' does not support writing.");
        }

        @Override
        public ReadStrategy getReadStrategy() {
            return new MarkdownReadStrategy();
        }
    },
    PDF("pdf") {
        @Override
        public WriteStrategy getWriteStrategy(FileSinkConfig fileSinkConfig) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Change the source format to a supported readable format (text, csv, json, parquet, orc).
  2. Use an appropriate CDC source connector instead of reading Maxwell JSON files via the file connector.
  3. Validate format capability (read vs write) against the FileFormat enum during config authoring.
  4. Keep maxwell_json only on sink-side configurations.

Example fix

// before
format = "maxwell_json"
// after
format = "json"
Defensive patterns

Strategy: validation

Validate before calling

FileFormat fmt = FileFormat.valueOf(config.get("format"));
try {
    fmt.getReadStrategy();
} catch (UnsupportedOperationException e) {
    throw new IllegalArgumentException("maxwell_json is write-only; choose a readable format");
}

Type guard

boolean isReadable(FileFormat fmt) {
    try { fmt.getReadStrategy(); return true; }
    catch (UnsupportedOperationException e) { return false; }
}

Try / catch

try {
    fmt.getReadStrategy();
} catch (UnsupportedOperationException e) {
    log.error("maxwell_json cannot be read by the file connector", e);
    throw new IllegalArgumentException(e);
}

Prevention

When it happens

Trigger: File source configured with format = "maxwell_json"; read-strategy resolution invokes FileFormat.MAXWELL_JSON.getReadStrategy().

Common situations: Copy-pasted sink config into a source; trying to read exported Maxwell CDC JSON files with the file connector.

Related errors


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