{"record":{"id":"7886e9dfa3da4ee3","repo":"apache/iceberg","slug":"unsupported-compression-codec-s","errorCode":null,"errorMessage":"Unsupported compression codec: %s","messagePattern":"Unsupported compression codec: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java","lineNumber":794,"sourceCode":"            compressionLevel,\n            rowGroupCheckMinRecordCount,\n            rowGroupCheckMaxRecordCount,\n            PARQUET_BLOOM_FILTER_MAX_BYTES_DEFAULT,\n            PARQUET_BLOOM_FILTER_ADAPTIVE_ENABLED_DEFAULT,\n            ImmutableMap.of(),\n            ImmutableMap.of(),\n            ImmutableMap.of(),\n            ImmutableMap.of(),\n            dictionaryEnabled,\n            ImmutableMap.of(),\n            dataContext.trackUncompressedRowGroupSize());\n      }\n\n      private static CompressionCodecName toCodec(String codecAsString) {\n        try {\n          return CompressionCodecName.valueOf(codecAsString.toUpperCase(Locale.ROOT));\n        } catch (IllegalArgumentException e) {\n          throw new IllegalArgumentException(\"Unsupported compression codec: \" + codecAsString);\n        }\n      }\n\n      private static WriterVersion toWriterVersion(String pageVersion) {\n        try {\n          return WriterVersion.fromString(pageVersion);\n        } catch (IllegalArgumentException e) {\n          throw new IllegalArgumentException(\n              \"Unsupported Parquet page version: \" + pageVersion + \" (must be v1 or v2)\");\n        }\n      }\n\n      int rowGroupSize() {\n        return rowGroupSize;\n      }\n\n      int pageSize() {\n        return pageSize;","sourceCodeStart":776,"sourceCodeEnd":812,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/parquet/src/main/java/org/apache/iceberg/parquet/Parquet.java#L776-L812","documentation":"Parquet.Context.toCodec converts a user-supplied compression codec string to a Parquet CompressionCodecName; unknown names raise this IllegalArgumentException. It validates the write compression setting before any file is written.","triggerScenarios":"Passing TableProperties.WRITE_COMPRESSION_CODEC / Parquet.PARQUET_COMPRESSION with a value not matching a Parquet codec enum name (valueOf is case-insensitive via toUpperCase but the name must otherwise match exactly).","commonSituations":"Typos like 'snappy ' or 'lz4hadoop' or 'brotli' on unsupported versions; setting the property with engine-specific codec names not present in parquet-mr's enum.","solutions":["Use one of the valid codec names: NONE, UNCOMPRESSED, SNAPPY, GZIP, LZO, BROTLI, LZ4, ZSTD","Check for whitespace or casing issues in the configured value","Upgrade parquet-mr/Iceberg if the codec (e.g. ZSTD) isn't in the enum version you use"],"exampleFix":"// before\ntable.updateProperties().set(\"write.parquet.compression-codec\", \"gzip2\").commit();\n// after\ntable.updateProperties().set(\"write.parquet.compression-codec\", \"GZIP\").commit();","handlingStrategy":"validation","validationCode":"String codec = props.getProperty(\"write.parquet.compression-codec\");\nif (codec != null) {\n  Set<String> valid = Set.of(\"NONE\",\"UNCOMPRESSED\",\"SNAPPY\",\"GZIP\",\"LZO\",\"BROTLI\",\"LZ4\",\"ZSTD\");\n  Preconditions.checkArgument(valid.contains(codec.toUpperCase(Locale.ROOT)), \"Unsupported compression codec: %s\", codec);\n}","typeGuard":null,"tryCatchPattern":"try {\n  newContext();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unsupported compression codec\")) { /* correct the property */ }\n  else throw e;\n}","preventionTips":["Keep an allowlist of valid codec names in config validation","Trim and normalize codec config values before use","Verify the codec is available in your parquet-mr version (e.g. ZSTD needs parquet >= 1.9/1.10)"],"tags":["parquet","configuration","compression"],"backgroundTag":"invalid-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}