apache/seatunnel · error · UnsupportedOperationException

File format 'pdf' does not support writing.

Error message

File format 'pdf' does not support writing.

What it means

The FileFormat enum maps file extensions to read/write strategies. PDF is read-only in this connector: its getWriteStrategy implementation unconditionally throws UnsupportedOperationException, so the sink path cannot write PDF files.

Source

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

                    "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) {
            throw new UnsupportedOperationException("File format 'pdf' does not support writing.");
        }

        @Override
        public ReadStrategy getReadStrategy() {
            return new PdfReadStrategy();
        }
    };

    private final String[] suffix;

    FileFormat(String... suffix) {
        this.suffix = suffix;
    }

    public String getSuffix() {
        if (suffix.length > 0) {
            return "." + suffix[0];
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Change the sink file format to a writable one such as text, csv, parquet, orc, or json
  2. If PDF output is required, write a supported format first and convert externally (e.g. with a post-processing script)
  3. If reading is the actual goal, verify you configured a source (not a sink) with format pdf

Example fix

// before
sink {
  LocalFile {
    path = "/tmp/output"
    file_format = "pdf"
  }
}
// after
sink {
  LocalFile {
    path = "/tmp/output"
    file_format = "parquet"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

if (fileFormat == FileFormat.PDF && isSink) {
    throw new IllegalArgumentException("PDF is read-only; use text/csv/parquet/orc/json for writing");
}

Prevention

When it happens

Trigger: Configuring a SeaTunnel file sink with format = pdf (FileFormat.PDF) causes getWriteStrategy(FileSinkConfig) to be invoked during sink initialization and immediately throw.

Common situations: Users assume that because PDF reading is supported, PDF writing is too, and set sink filetype to pdf; copy-pasting a source config into a sink config; migrating a job from another tool that supports PDF export.

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