spring-projects/spring-boot · error · IllegalStateException

zstd compression is not supported

Error message

zstd compression is not supported

What it means

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.

Solutions

  1. Re-package the source as a gzip or uncompressed tar before passing it in.
  2. If consuming an image, use a version whose layers are gzip-compressed.
  3. Never pass Compression.ZSTD to TarArchive.fromInputStream; select GZIP or NONE.

Example fix

// before
TarArchive ta = TarArchive.fromInputStream(in, Compression.ZSTD);
ta.writeTo(out); // throws
// after (re-compress the stream to gzip first, then)
TarArchive ta = TarArchive.fromInputStream(gzipIn, Compression.GZIP);
Defensive patterns

Strategy: validation

Validate before calling

// Reject zstd up front with a helpful message
if (compression == TarArchive.Compression.ZSTD) {
    throw new IllegalArgumentException(
        "zstd-compressed tar archives are not supported. Re-package as gzip or uncompressed.");
}

Try / catch

try {
    tarArchive.writeTo(out);
} catch (IllegalStateException ex) {
    if ("zstd compression is not supported".equals(ex.getMessage())) {
        // re-compress the source as gzip and retry
    }
    throw ex;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of spring-projects/spring-boot@270dfe353f (2026-08-11). Data as JSON: /api/errors/6743e0b118873542. Report an issue: GitHub.

Appendix: source

Thrown at buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/TarArchive.java:135

		 * The tar file is not compressed.
		 */
		NONE((inputStream) -> inputStream),

		/**
		 * The tar file is compressed using gzip.
		 */
		GZIP(GZIPInputStream::new),

		/**
		 * The tar file is compressed using zstd.
		 */
		ZSTD("zstd compression is not supported");

		private final ThrowingFunction<InputStream, InputStream> uncompressor;

		Compression(String uncompressError) {
			this((inputStream) -> {
				throw new IllegalStateException(uncompressError);
			});
		}

		Compression(ThrowingFunction<InputStream, InputStream> wrapper) {
			this.uncompressor = wrapper;
		}

		InputStream uncompress(InputStream inputStream) {
			return this.uncompressor.apply(inputStream);
		}

	}

}

View on GitHub (pinned to 270dfe353f)