gradle/gradle · error · RuntimeException
Unable to create gzip output stream for file %s.
Error message
Unable to create gzip output stream for file %s.
What it means
Gradle throws this error when the following condition is violated: Unable to create gzip output stream for file <value>.
Source
Thrown at platforms/core-configuration/file-operations/src/main/java/org/gradle/api/internal/file/archive/compression/GzipArchiver.java:50
super(resource);
}
@Override
protected String getSchemePrefix() {
return "gzip:";
}
public static ArchiveOutputStreamFactory getCompressor() {
// this is not very beautiful but at some point we will
// get rid of ArchiveOutputStreamFactory in favor of the writable Resource
return destination -> {
OutputStream outStr = new FileOutputStream(destination);
try {
return new GZIPOutputStream(outStr);
} catch (Exception e) {
IoActions.closeQuietly(outStr);
String message = String.format("Unable to create gzip output stream for file %s.", destination);
throw new RuntimeException(message, e);
}
};
}
@Override
public InputStream read() {
InputStream input = new BufferedInputStream(resource.read());
try {
return new GZIPInputStream(input);
} catch (Exception e) {
IoActions.closeQuietly(input);
throw ResourceExceptions.readFailed(resource.getDisplayName(), e);
}
}
}
View on GitHub (pinned to 534f27719b)
Solutions
- Verify the archive file exists and is a valid, non-corrupted archive.
- Specify the compression explicitly if the archive extension is misleading.
When it happens
Trigger: Thrown at platforms/core-configuration/file-operations/src/main/java/org/gradle/api/internal/file/archive/compression/GzipArchiver.java:50 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of gradle/gradle@534f27719b (2026-08-22).
Data as JSON: /api/errors/9a9db3fe6a8ac14d.
Report an issue: GitHub.