apache/seatunnel · warning

Json file does not support this compress type: {}

Error message

Json file does not support this compress type: {}

What it means

Warning from JsonWriteStrategy.getOrCreateOutputStream when the compress format configured for a JSON text sink has no explicit handling branch. The strategy logs and writes uncompressed output instead, silently ignoring the requested compression.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sink/writer/JsonWriteStrategy.java:133

    @Override
    public FSDataOutputStream getOrCreateOutputStream(@NonNull String filePath) {
        FSDataOutputStream fsDataOutputStream = beingWrittenOutputStream.get(filePath);
        if (fsDataOutputStream == null) {
            try {
                switch (compressFormat) {
                    case LZO:
                        LzopCodec lzo = new LzopCodec();
                        OutputStream out =
                                lzo.createOutputStream(
                                        hadoopFileSystemProxy.getOutputStream(filePath));
                        fsDataOutputStream = new FSDataOutputStream(out, null);
                        break;
                    case NONE:
                        fsDataOutputStream = hadoopFileSystemProxy.getOutputStream(filePath);
                        break;
                    default:
                        log.warn(
                                "Json file does not support this compress type: {}",
                                compressFormat.getCompressCodec());
                        fsDataOutputStream = hadoopFileSystemProxy.getOutputStream(filePath);
                        break;
                }
                beingWrittenOutputStream.put(filePath, fsDataOutputStream);
                isFirstWrite.put(filePath, true);
            } catch (IOException e) {
                throw CommonError.fileOperationFailed("JsonFile", "open", filePath, e);
            }
        }
        return fsDataOutputStream;
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Use compress = "gzip" or "none" for json file format sinks
  2. Check the docs for the compress formats supported by json output
  3. Move to ORC/Parquet formats for richer codec support
  4. Add a case for the codec in JsonWriteStrategy.getOrCreateOutputStream if needed

Example fix

// before
sink = {
  file_format = "json"
  compress = "snappy"
}
// after
sink = {
  file_format = "json"
  compress = "gzip"
}
Defensive patterns

Strategy: validation

Validate before calling

Set<String> supported = Set.of("none", "lzo", "gzip");
if (!supported.contains(compressValue.toLowerCase())) {
    throw new IllegalArgumentException("json sink supports compress " + supported + ", got: " + compressValue);
}

Prevention

When it happens

Trigger: file_format=json sink with compress set to an unhandled codec (e.g. ZSTD, SNAPPY for text output); fires when the first record triggers stream creation in getOrCreateOutputStream.

Common situations: Copy-pasted configs from parquet/orc sinks; assumption that all Hadoop compression codecs work for text JSON; upstream enum additions not mirrored in JsonWriteStrategy.

Related errors


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