{"record":{"id":"6743e0b118873542","repo":"spring-projects/spring-boot","slug":"zstd-compression-is-not-supported","errorCode":null,"errorMessage":"zstd compression is not supported","messagePattern":"zstd compression is not supported","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/TarArchive.java","lineNumber":135,"sourceCode":"\t\t * The tar file is not compressed.\n\t\t */\n\t\tNONE((inputStream) -> inputStream),\n\n\t\t/**\n\t\t * The tar file is compressed using gzip.\n\t\t */\n\t\tGZIP(GZIPInputStream::new),\n\n\t\t/**\n\t\t * The tar file is compressed using zstd.\n\t\t */\n\t\tZSTD(\"zstd compression is not supported\");\n\n\t\tprivate final ThrowingFunction<InputStream, InputStream> uncompressor;\n\n\t\tCompression(String uncompressError) {\n\t\t\tthis((inputStream) -> {\n\t\t\t\tthrow new IllegalStateException(uncompressError);\n\t\t\t});\n\t\t}\n\n\t\tCompression(ThrowingFunction<InputStream, InputStream> wrapper) {\n\t\t\tthis.uncompressor = wrapper;\n\t\t}\n\n\t\tInputStream uncompress(InputStream inputStream) {\n\t\t\treturn this.uncompressor.apply(inputStream);\n\t\t}\n\n\t}\n\n}\n","sourceCodeStart":117,"sourceCodeEnd":150,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/TarArchive.java#L117-L150","documentation":"TarArchive.Compression.ZSTD is an enum constant whose uncompressor is hard-coded to throw IllegalStateException('zstd compression is not supported'). The enum exists so callers can express zstd as a compression type, but no decompressor is wired in. The buildpack supports NONE and GZIP only; any code path that calls Compression.ZSTD.uncompress(stream) — directly or via TarArchive.fromInputStream(stream, Compression.ZSTD).writeTo(...) — will fail.","triggerScenarios":"TarArchive.fromInputStream(inputStream, Compression.ZSTD) is constructed and writeTo is called; writeTo calls compression.uncompress(inputStream) (line 98) which applies the throwing function at line 134-136.","commonSituations":"A source archive or layer declared as zstd-compressed; integrating with a registry/image whose layers use zstd (newer Docker/OCI images may use zstd); a caller that picks Compression.ZSTD by default.","solutions":["Re-package the source as a gzip or uncompressed tar before passing it in.","If consuming an image, use a version whose layers are gzip-compressed.","Never pass Compression.ZSTD to TarArchive.fromInputStream; select GZIP or NONE."],"exampleFix":"// before\nTarArchive ta = TarArchive.fromInputStream(in, Compression.ZSTD);\nta.writeTo(out); // throws\n// after (re-compress the stream to gzip first, then)\nTarArchive ta = TarArchive.fromInputStream(gzipIn, Compression.GZIP);","handlingStrategy":"validation","validationCode":"// Reject zstd up front with a helpful message\nif (compression == TarArchive.Compression.ZSTD) {\n    throw new IllegalArgumentException(\n        \"zstd-compressed tar archives are not supported. Re-package as gzip or uncompressed.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    tarArchive.writeTo(out);\n} catch (IllegalStateException ex) {\n    if (\"zstd compression is not supported\".equals(ex.getMessage())) {\n        // re-compress the source as gzip and retry\n    }\n    throw ex;\n}","preventionTips":["Never select Compression.ZSTD; only NONE and GZIP are implemented.","Normalize incoming archives to gzip or uncompressed before passing them in.","When consuming images, prefer those with gzip layers."],"tags":["docker","tar","compression","zstd","buildpack"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}