{"record":{"id":"62c7ed0cc9af29af","repo":"apache/beam","slug":"zip-is-unsupported","errorCode":null,"errorMessage":"ZIP is unsupported","messagePattern":"ZIP is unsupported","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java","lineNumber":195,"sourceCode":"      return canonical.writeCompressed(channel);\n    }\n\n    public static CompressionType fromCanonical(Compression canonical) {\n      switch (canonical) {\n        case AUTO:\n          throw new IllegalArgumentException(\"AUTO is not supported for writing\");\n\n        case UNCOMPRESSED:\n          return UNCOMPRESSED;\n\n        case GZIP:\n          return GZIP;\n\n        case BZIP2:\n          return BZIP2;\n\n        case ZIP:\n          throw new IllegalArgumentException(\"ZIP is unsupported\");\n\n        case ZSTD:\n          return ZSTD;\n\n        case LZO:\n          return LZO;\n\n        case LZOP:\n          return LZOP;\n\n        case DEFLATE:\n          return DEFLATE;\n\n        case SNAPPY:\n          return SNAPPY;\n\n        default:\n          throw new UnsupportedOperationException(\"Unsupported compression type: \" + canonical);","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java#L177-L213","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\n.apply(TextIO.write().to(output).withCompression(Compression.ZIP));\n// after\n.apply(TextIO.write().to(output).withCompression(Compression.GZIP));","handlingStrategy":"validation","validationCode":"if (compression == Compression.ZIP) { throw new IllegalArgumentException(\"ZIP output not supported by FileBasedSink; use GZIP\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["java","apache-beam","compression","unsupported-feature"],"backgroundTag":"unsupported-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}