{"record":{"id":"f261dda798d59fe5","repo":"apache/beam","slug":"auto-is-not-supported-for-writing","errorCode":null,"errorMessage":"AUTO is not supported for writing","messagePattern":"AUTO is not supported for writing","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java","lineNumber":183,"sourceCode":"    @Override\n    public String getSuggestedFilenameSuffix() {\n      return canonical.getSuggestedSuffix();\n    }\n\n    @Override\n    public @Nullable String getMimeType() {\n      return (canonical == Compression.UNCOMPRESSED) ? null : MimeTypes.BINARY;\n    }\n\n    @Override\n    public WritableByteChannel create(WritableByteChannel channel) throws IOException {\n      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;","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileBasedSink.java#L165-L201","documentation":"FileBasedSink.CompressionType.fromCanonical maps a canonical Compression enum to a write-side CompressionType. AUTO means 'detect from filename when reading' and is meaningless for sinks, so the method throws IllegalArgumentException immediately.","triggerScenarios":"Calling FileBasedSink.CompressionType.fromCanonical(Compression.AUTO); constructing a sink whose write compression is AUTO (e.g., via withCompression(AUTO) on FileBasedSink-based sinks).","commonSituations":"Shared pipeline options carrying compression=AUTO used for both input and output; users expecting AUTO to pick compression automatically on write; read/write config shared from a template.","solutions":["Choose an explicit write CompressionType (GZIP, BZIP2, ZSTD, or UNCOMPRESSED) for the sink.","Substitute UNCOMPRESSED when the configured value is AUTO before constructing the sink.","Validate sink compression options at pipeline build time and reject AUTO with a clear message."],"exampleFix":"// before\nFileBasedSink.CompressionType.fromCanonical(Compression.AUTO);\n// after\nCompression c = config.getCompression();\nFileBasedSink.CompressionType t = (c == Compression.AUTO)\n    ? FileBasedSink.CompressionType.UNCOMPRESSED\n    : FileBasedSink.CompressionType.fromCanonical(c);","handlingStrategy":"validation","validationCode":"Compression c = config.getCompression();\nif (c == null || c == Compression.AUTO) c = Compression.UNCOMPRESSED;","typeGuard":null,"tryCatchPattern":"try {\n  type = FileBasedSink.CompressionType.fromCanonical(canonical);\n} catch (IllegalArgumentException e) {\n  type = FileBasedSink.CompressionType.UNCOMPRESSED;\n}","preventionTips":["Keep read and write compression configs separate","Reject AUTO for sinks during option validation","Default sink compression explicitly (UNCOMPRESSED or GZIP)"],"tags":["java","io","compression","sink","illegal-argument"],"backgroundTag":"invalid-argument-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}