{"record":{"id":"5fc8a956ac7f94f9","repo":"apache/iceberg","slug":"unsupported-codec","errorCode":null,"errorMessage":"Unsupported codec: ","messagePattern":"Unsupported codec: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/puffin/PuffinFormat.java","lineNumber":117,"sourceCode":"  static int readIntegerLittleEndian(byte[] data, int offset) {\n    return Byte.toUnsignedInt(data[offset])\n        | (Byte.toUnsignedInt(data[offset + 1]) << 8)\n        | (Byte.toUnsignedInt(data[offset + 2]) << 16)\n        | (Byte.toUnsignedInt(data[offset + 3]) << 24);\n  }\n\n  static ByteBuffer compress(PuffinCompressionCodec codec, ByteBuffer input) {\n    switch (codec) {\n      case NONE:\n        return input.duplicate();\n      case LZ4:\n        // TODO requires LZ4 frame compressor, e.g.\n        // https://github.com/airlift/aircompressor/pull/142\n        break;\n      case ZSTD:\n        return compress(new ZstdCompressor(), input);\n    }\n    throw new UnsupportedOperationException(\"Unsupported codec: \" + codec);\n  }\n\n  private static ByteBuffer compress(Compressor compressor, ByteBuffer input) {\n    ByteBuffer output = ByteBuffer.allocate(compressor.maxCompressedLength(input.remaining()));\n    compressor.compress(input.duplicate(), output);\n    output.flip();\n    return output;\n  }\n\n  static ByteBuffer decompress(PuffinCompressionCodec codec, ByteBuffer input) {\n    switch (codec) {\n      case NONE:\n        return input.duplicate();\n\n      case LZ4:\n        // TODO requires LZ4 frame decompressor, e.g.\n        // https://github.com/airlift/aircompressor/pull/142\n        break;","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/puffin/PuffinFormat.java#L99-L135","documentation":"PuffinFormat.compress only implements GZIP, ZSTD (and a stubbed LZ4 case). For any other codec (e.g. LZ4, which has no Java frame compressor wired in), it throws UnsupportedOperationException('Unsupported codec: ...') because the library cannot compress puffin blobs with that codec.","triggerScenarios":"Writing puffin files (e.g. deletion vectors / blob stats) with blob properties requesting LZ4 or another codec that PuffinFormat cannot compress; configuring a writer to emit a compression codec not in {gzip, zstd}.","commonSituations":"Specs/tools expecting LZ4-compressed puffin blobs (LZ4 frame compression is still unimplemented, per the TODO referencing airlift aircompressor PR #142); copying compression settings from another engine that supports LZ4.","solutions":["Use ZSTD or GZIP compression for puffin blobs instead of LZ4","Omit the compression codec property to write uncompressed blobs","If LZ4 is required, write the blob yourself with an LZ4 frame compressor and register/produce it outside PuffinFormat, or wait for upstream LZ4 support (aircompressor PR #142)","Check the codec requested by your blob writer configuration and change it to a supported one"],"exampleFix":"// before\nbuilder.compressionCodec(Lz4Compressor.class.getSimpleName()); // unsupported\n// after\nbuilder.compressionCodec(\"zstd\"); // or \"gzip\" / none","handlingStrategy":"validation","validationCode":"Set<String> supported = Set.of(\"gzip\", \"zstd\");\nif (codec != null && !supported.contains(codec.toLowerCase(Locale.ROOT))) {\n  throw new IllegalArgumentException(\"Codec not supported for puffin: \" + codec);\n}","typeGuard":null,"tryCatchPattern":"try {\n  writeBlob(input, codec);\n} catch (UnsupportedOperationException e) {\n  writeBlob(input, \"zstd\"); // fall back to a supported codec\n}","preventionTips":["Only request gzip or zstd for puffin blob compression","Check the current PuffinFormat source for supported codecs before configuring LZ4","Write blobs uncompressed if compression is not essential"],"tags":["puffin","compression","unsupported-codec","lz4"],"backgroundTag":"unsupported-operation","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"}