apache/iceberg · error · IllegalArgumentException
Unsupported compression codec:
Error message
Unsupported compression codec:
What it means
ORC.DrwBuilder/compressionKind converts the user-supplied write.property value for compression into ORC's CompressionKind enum via valueOf on the uppercased string. If the string is not a valid ORC CompressionKind name (e.g. zstd on a build without zstd, or a typo like 'snappy ' or 'gzip2'), IllegalArgumentException is thrown with this message.
Solutions
- Use a valid ORC codec name: ZSTD, LZ4, LZO, SNAPPY, ZLIB, GZIP, or NONE
- Check the installed ORC library version supports the codec (e.g. ZSTD requires ORC with zstd support)
- Remove the write.orc.compression-codec property to use the ORC default
- Trim whitespace/typos in the property value
Example fix
// before
table.updateProperties().set("write.orc.compression-codec", "BROTLI").commit();
// after
table.updateProperties().set("write.orc.compression-codec", "ZSTD").commit(); Defensive patterns
Strategy: validation
Validate before calling
Set<String> valid = Set.of("ZSTD","ZLIB","SNAPPY","LZO","LZ4","GZIP","NONE");
String codec = props.getProperty("write.orc.compression-codec", "").toUpperCase(Locale.ROOT).trim();
if (!valid.contains(codec)) throw new IllegalArgumentException("Invalid ORC codec: " + codec); Try / catch
try {
writer = ORC.write(output).set("write.orc.compression-codec", codec).build();
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Unsupported compression codec")) {
log.warn("Falling back to default ORC compression: {}", e.getMessage());
writer = ORC.write(output).build();
} else throw e;
} Prevention
- Only use ORC enum names: NOT ZSTD variants aside, valid values are ZSTD, ZLIB, SNAPPY, LZO, LZ4, GZIP, NONE
- Do not copy Parquet codec names into ORC properties
- Trim whitespace from property values
- Verify ORC library version supports the desired codec
When it happens
Trigger: Setting write.orc.compression-codec (or the builder's configValue) to a string that is not exactly one of ORC's CompressionKind enum names after uppercasing: NOT ZSTD, ZLIB, SNAPPY, LZO, LZ4, NONE, GZIP.
Common situations: Typo in table property (e.g. 'ZSTD_1', 'snappy-compression'); using a codec like ZSTD on an older ORC library that lacks it; copying Parquet codec names (e.g. 'BROTLI', 'GZIP_LEVEL') into ORC properties.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unsupported compression strategy:
- Ignoring invalid metrics mode
- Unknown file content:
- Unsupported compression codec
- Batch reading is not supported in non-vectorized reader
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/a6110c8060210115.
Report an issue: GitHub.
Appendix: source
Thrown at orc/src/main/java/org/apache/iceberg/orc/ORC.java:381
strategyAsString != null
? toCompressionStrategy(strategyAsString)
: dataContext.compressionStrategy();
return new Context(
stripeSize,
blockSize,
vectorizedRowBatchSize,
compressionKind,
compressionStrategy,
dataContext.bloomFilterColumns(),
dataContext.bloomFilterFpp());
}
private static CompressionKind toCompressionKind(String codecAsString) {
try {
return CompressionKind.valueOf(codecAsString.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Unsupported compression codec: " + codecAsString);
}
}
private static CompressionStrategy toCompressionStrategy(String strategyAsString) {
try {
return CompressionStrategy.valueOf(strategyAsString.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(
"Unsupported compression strategy: " + strategyAsString);
}
}
}
}
public static DataWriteBuilder writeData(OutputFile file) {
return new DataWriteBuilder(file);
}
View on GitHub (pinned to 86d9c8fc54)