{"record":{"id":"a83a26f923dcc8c2","repo":"apache/flink","slug":"an-i-o-error-occurred-while-creating-temporary-fil","errorCode":null,"errorMessage":"An I/O error occurred while creating temporary file to extract nested library '{entry.getName()}'.","messagePattern":"An I/O error occurred while creating temporary file to extract nested library '(.+?)'\\.","errorType":"exception","errorClass":"ProgramInvocationException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java","lineNumber":591,"sourceCode":"            return output;\n        } catch (IOException e) {\n            throw new ProgramInvocationException(\n                    \"An I/O error occurred while extracting nested library '\"\n                            + input.getName()\n                            + \"' to temporary file '\"\n                            + output.getAbsolutePath()\n                            + \"'.\");\n        }\n    }\n\n    private static File createTempFile(Random rnd, JarEntry entry, String name)\n            throws ProgramInvocationException {\n        try {\n            final File tempFile = File.createTempFile(rnd.nextInt(Integer.MAX_VALUE) + \"_\", name);\n            tempFile.deleteOnExit();\n            return tempFile;\n        } catch (IOException e) {\n            throw new ProgramInvocationException(\n                    \"An I/O error occurred while creating temporary file to extract nested library '\"\n                            + entry.getName()\n                            + \"'.\",\n                    e);\n        }\n    }\n\n    private static List<JarEntry> getContainedJarEntries(JarFile jar) {\n        return jar.stream()\n                .filter(\n                        jarEntry -> {\n                            final String name = jarEntry.getName();\n                            return name.length() > 8\n                                    && name.startsWith(\"lib/\")\n                                    && name.endsWith(\".jar\");\n                        })\n                .collect(Collectors.toList());\n    }","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/PackagedProgram.java#L573-L609","documentation":"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.","triggerScenarios":"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.","commonSituations":"Container with a read-only /tmp, tmpfs exhausted, or an entry name with characters that break temp file naming on the target OS.","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."],"exampleFix":"// before\njava -jar flink.jar  # uses default /tmp which is read-only\n\n// after\nmkdir -p /var/flink-tmp\njava -Djava.io.tmpdir=/var/flink-tmp -jar flink.jar","handlingStrategy":"validation","validationCode":"File tmpDir = new File(System.getProperty(\"java.io.tmpdir\"));\nif (!tmpDir.exists() || !tmpDir.canWrite()) {\n    throw new IllegalStateException(\"Temp dir missing or not writable: \" + tmpDir);\n}","typeGuard":null,"tryCatchPattern":"try {\n    PackagedProgram.extractContainedLibraries(jarUrl);\n} catch (ProgramInvocationException e) {\n    if (e.getMessage().contains(\"creating temporary file\")) {\n        // fix tmp dir permissions or set java.io.tmpdir\n    }\n    throw e;\n}","preventionTips":["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'."],"tags":["packaged-program","io","temp-files","filesystem","permissions"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}