apache/flink · error · ProgramInvocationException
An I/O error occurred while creating temporary file to extra
Error message
An I/O error occurred while creating temporary file to extract nested library '{entry.getName()}'. What it means
Thrown when File.createTempFile fails with an IOException while extracting a nested library. The temp file could not be created in the system temp directory. The entry name is included for diagnosis. Note: the original IOException is chained as the cause.
Source
Thrown at flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java:591
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()
+ "'.",
e);
}
}
private static List<JarEntry> getContainedJarEntries(JarFile jar) {
return jar.stream()
.filter(
jarEntry -> {
final String name = jarEntry.getName();
return name.length() > 8
&& name.startsWith("lib/")
&& name.endsWith(".jar");
})
.collect(Collectors.toList());
}View on GitHub (pinned to 2f3c205e92)
Solutions
- Ensure java.io.tmpdir exists and is writable: 'ls -ld /tmp'.
- Set -Djava.io.tmpdir to a known-good writable directory.
- Check inode availability with 'df -i'.
- Inspect the jar for entries whose names contain unusual characters.
Example fix
// before java -jar flink.jar # uses default /tmp which is read-only // after mkdir -p /var/flink-tmp java -Djava.io.tmpdir=/var/flink-tmp -jar flink.jar
Defensive patterns
Strategy: validation
Validate before calling
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
if (!tmpDir.exists() || !tmpDir.canWrite()) {
throw new IllegalStateException("Temp dir missing or not writable: " + tmpDir);
} Try / catch
try {
PackagedProgram.extractContainedLibraries(jarUrl);
} catch (ProgramInvocationException e) {
if (e.getMessage().contains("creating temporary file")) {
// fix tmp dir permissions or set java.io.tmpdir
}
throw e;
} Prevention
- Always set -Djava.io.tmpdir to a known-writable directory in containers.
- Verify temp dir permissions before job submission.
- Check inode availability with 'df -i'.
When it happens
Trigger: File.createTempFile fails because java.io.tmpdir does not exist, is not writable, has no remaining inodes, or the filename (derived from the entry name) contains illegal characters for the filesystem.
Common situations: Container with a read-only /tmp, tmpfs exhausted, or an entry name with characters that break temp file naming on the target OS.
Related errors
- Unknown I/O error while extracting contained jar files.
- An I/O error occurred while extracting nested library '{inpu
- Failed to create parent(s) for given base dir: %s
- Failed to list contents of {directory}
- Failed to get metadata for key: {}
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/a83a26f923dcc8c2.
Report an issue: GitHub.