apache/beam · error · IllegalArgumentException
ZIP is unsupported
Error message
ZIP is unsupported
What it means
FileBasedSink.Compression.fromCanonical() rejects the ZIP canonical type with an IllegalArgumentException when translating a Compression enum value into a sink compression type. ZIP is deliberately not supported for writing file-based sinks in Beam, so selecting it fails fast at pipeline construction.
Solutions
- Use Compression.GZIP instead of ZIP for compressed output.
- Use Compression.BZIP2 or Compression.ZSTD if the format is negotiable.
- If ZIP is mandatory, write uncompressed and zip the output in a downstream job outside Beam.
Example fix
// before .apply(TextIO.write().to(output).withCompression(Compression.ZIP)); // after .apply(TextIO.write().to(output).withCompression(Compression.GZIP));
Defensive patterns
Strategy: validation
Validate before calling
if (compression == Compression.ZIP) { throw new IllegalArgumentException("ZIP output not supported by FileBasedSink; use GZIP"); } Prevention
- Restrict compression config enums to the supported set (UNCOMPRESSED, GZIP, BZIP2, ZSTD, SNAPPY, DEFLATE).
- Validate compression settings at config-parse time, not at pipeline-build time.
When it happens
Trigger: Calling FileIO.write()/WriteFiles with a sink whose Compression is set to Compression.ZIP, e.g. via TextIO/AvroIO-style configuration or FileBasedSink.withCompression(Compression.ZIP).
Common situations: Developers migrating code that used ZIP-compressed output elsewhere, or setting compression generically from a config file where ZIP appears as a valid-looking option.
Related errors
- Unsupported compression type: " + canonical
- configuration with compression is not compatible with…
- configuration with compression is not compatible with AvroIO
- Upgrading KafkaIO write transforms that have…
- A function must be provided to convert the input type into…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/62c7ed0cc9af29af.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java:195
return canonical.writeCompressed(channel);
}
public static CompressionType fromCanonical(Compression canonical) {
switch (canonical) {
case AUTO:
throw new IllegalArgumentException("AUTO is not supported for writing");
case UNCOMPRESSED:
return UNCOMPRESSED;
case GZIP:
return GZIP;
case BZIP2:
return BZIP2;
case ZIP:
throw new IllegalArgumentException("ZIP is unsupported");
case ZSTD:
return ZSTD;
case LZO:
return LZO;
case LZOP:
return LZOP;
case DEFLATE:
return DEFLATE;
case SNAPPY:
return SNAPPY;
default:
throw new UnsupportedOperationException("Unsupported compression type: " + canonical);View on GitHub (pinned to 12126d8942)