apache/flink · error · ProgramInvocationException
An I/O error occurred while extracting nested library '{inpu
Error message
An I/O error occurred while extracting nested library '{input.getName()}' to temporary file '{output.getAbsolutePath()}'. What it means
Thrown when an IOException occurs while copying a nested jar entry to a temporary file during library extraction. The stream copy loop (read from JarEntry input, write to temp File output) failed. Both the source entry name and the target temp file path are included in the message for diagnosis.
Source
Thrown at flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java:575
} catch (Throwable t) {
throw new ProgramInvocationException(
"Unknown I/O error while extracting contained jar files.", t);
}
}
private static File copyLibToTempFile(
String name, Random rnd, JarFile jar, JarEntry input, byte[] buffer)
throws ProgramInvocationException {
final File output = createTempFile(rnd, input, name);
try (final OutputStream out = new FileOutputStream(output);
final InputStream in = new BufferedInputStream(jar.getInputStream(input))) {
int numRead = 0;
while ((numRead = in.read(buffer)) != -1) {
out.write(buffer, 0, numRead);
}
return output;
} catch (IOException e) {
throw new ProgramInvocationException(
"An I/O error occurred while extracting nested library '"
+ input.getName()
+ "' to temporary file '"
+ output.getAbsolutePath()
+ "'.");
}
}
private static File createTempFile(Random rnd, JarEntry entry, String name)
throws ProgramInvocationException {
try {
final File tempFile = File.createTempFile(rnd.nextInt(Integer.MAX_VALUE) + "_", name);
tempFile.deleteOnExit();
return tempFile;
} catch (IOException e) {
throw new ProgramInvocationException(
"An I/O error occurred while creating temporary file to extract nested library '"
+ entry.getName()View on GitHub (pinned to 2f3c205e92)
Solutions
- Free up space in the temp directory or point java.io.tmpdir to a larger volume.
- Check disk quota with 'df -h' and 'du -sh /tmp'.
- Re-examine the jar for corrupt nested jars (run 'jar tf' and look for unusual entries).
- If in Kubernetes, increase the emptyDir or ephemeral-storage size.
Example fix
// before: default tmp dir too small java ... -Djava.io.tmpdir=/small/tmp // after: point to a volume with sufficient space java ... -Djava.io.tmpdir=/data/flink-tmp
Defensive patterns
Strategy: validation
Validate before calling
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
long freeSpace = tmpDir.getUsableSpace();
if (freeSpace < requiredBytes) {
throw new IllegalStateException("Insufficient temp space: " + freeSpace);
} Try / catch
try {
PackagedProgram.extractContainedLibraries(jarUrl);
} catch (ProgramInvocationException e) {
if (e.getMessage().contains("I/O error occurred while extracting nested library")) {
// check disk space and permissions
}
throw e;
} Prevention
- Monitor free disk space on the temp volume.
- Point java.io.tmpdir to a volume sized for the largest expected jar extraction.
- In Kubernetes, size emptyDir/ephemeral-storage appropriately.
When it happens
Trigger: Disk full during extraction, temp file permissions revoked mid-copy, the nested jar entry is corrupt and the read fails, or the output stream is closed externally. Triggered inside copyLibToTempFile.
Common situations: Container /tmp volume is too small for the extracted libraries, disk quota exceeded, or the jar contains a malformed nested jar entry that causes a read error.
Related errors
- Unknown I/O error while extracting contained jar files.
- An I/O error occurred while creating temporary file to extra
- Error while opening jar file '{jarFile.getPath()}'. {ioex.ge
- The Manifest in the jar file could not be accessed '{jarFile
- Could not close the JAR file: {t.getMessage()}
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/91d31587ea67eaac.
Report an issue: GitHub.