apache/seatunnel · error · UnsupportedOperationException
File format 'markdown' does not support writing.
Error message
File format 'markdown' does not support writing.
What it means
The MARKDOWN FileFormat enum member only supports reading (MarkdownReadStrategy). Calling getWriteStrategy() on it throws UnsupportedOperationException because writing markdown output files is not supported by the file sink.
Source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/config/FileFormat.java:179
"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) {
throw new UnsupportedOperationException("File format 'pdf' does not support writing.");
}
@Override
public ReadStrategy getReadStrategy() {
return new PdfReadStrategy();
}View on GitHub (pinned to cf67b549a7)
Solutions
- Change the sink format to a writable format (text, csv, json, parquet, orc, canal_json, debezium_json, maxwell_json).
- If markdown output is needed, write as 'text' and format the content, or generate markdown downstream.
- Check the FileFormat capability matrix (read vs write) before configuring a sink.
- Keep 'md'/'markdown' only in source configurations.
Example fix
// before
sink {
LocalFile {
format = "markdown"
}
}
// after
sink {
LocalFile {
format = "text"
}
} Defensive patterns
Strategy: validation
Validate before calling
FileFormat fmt = FileFormat.valueOf(config.get("format"));
try {
fmt.getWriteStrategy(fileSinkConfig);
} catch (UnsupportedOperationException e) {
throw new IllegalArgumentException("markdown is read-only; choose a writable format");
} Type guard
boolean isWritable(FileFormat fmt, FileSinkConfig cfg) {
try { fmt.getWriteStrategy(cfg); return true; }
catch (UnsupportedOperationException e) { return false; }
} Try / catch
try {
fmt.getWriteStrategy(fileSinkConfig);
} catch (UnsupportedOperationException e) {
log.error("markdown cannot be used as a file sink format; use text/csv/json/parquet", e);
throw new IllegalArgumentException(e);
} Prevention
- Treat 'md'/'markdown' strictly as a source format.
- Probe FileFormat.getWriteStrategy during sink config validation.
- Use 'text' plus post-processing when markdown-like output is required.
- Audit format fields when converting source configs into sink configs.
When it happens
Trigger: Configuring a file sink with format = "md" or "markdown"; write-strategy resolution invokes FileFormat.MARKDOWN.getWriteStrategy().
Common situations: Reusing a markdown source config for a sink; assuming all readable formats are also writable; exporting query results to markdown via the file sink.
Related errors
- FORMAT_NOT_SUPPORT
- File format 'canal_json' does not support reading.
- File format 'debezium_json' does not support reading.
- File format 'maxwell_json' does not support reading.
- FILE_TYPE_INVALID
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/29774219b6d0eb2b.
Report an issue: GitHub.