{"record":{"id":"e9c8a2de8829b9a2","repo":"apache/flink","slug":"create-dir-outputfile-getabsolutepath-failed","errorCode":null,"errorMessage":"Create dir: {outputFile.getAbsolutePath()} failed!","messagePattern":"Create dir: (.+?) failed!","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/CompressionUtils.java","lineNumber":236,"sourceCode":"            boolean isUnix = isUnix();\n            ByteArrayOutputStream baos = new ByteArrayOutputStream();\n            String canonicalTargetPath = new File(targetPath).getCanonicalPath() + File.separator;\n\n            while (entries.hasMoreElements()) {\n                ZipArchiveEntry entry = entries.nextElement();\n                File outputFile = new File(canonicalTargetPath, entry.getName());\n                if (!outputFile.getCanonicalPath().startsWith(canonicalTargetPath)) {\n                    throw new IOException(\n                            \"Expand \"\n                                    + entry.getName()\n                                    + \" would create a file outside of \"\n                                    + targetPath);\n                }\n\n                if (entry.isDirectory()) {\n                    if (!outputFile.exists()) {\n                        if (!outputFile.mkdirs()) {\n                            throw new IOException(\n                                    \"Create dir: \" + outputFile.getAbsolutePath() + \" failed!\");\n                        }\n                    }\n                } else {\n                    File parentDir = outputFile.getParentFile();\n                    if (!parentDir.exists()) {\n                        if (!parentDir.mkdirs()) {\n                            throw new IOException(\n                                    \"Create dir: \" + outputFile.getAbsolutePath() + \" failed!\");\n                        }\n                    }\n                    if (entry.isUnixSymlink()) {\n                        // the content of the file is the target path of the symlink\n                        baos.reset();\n                        IOUtils.copyBytes(zipFile.getInputStream(entry), baos);\n                        Files.createSymbolicLink(\n                                outputFile.toPath(), new File(parentDir, baos.toString()).toPath());\n                    } else if (outputFile.createNewFile()) {","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/CompressionUtils.java#L218-L254","documentation":"Thrown while extracting a zip entry that is a directory: the entry does not already exist and mkdirs() failed. The path passed traversal validation, so this is a filesystem-level failure creating the directory (permissions, conflicting file, invalid name, disk issue).","triggerScenarios":"extractZipFileWithPermissions encounters a directory entry whose mkdirs() returns false: read-only target, an existing regular file at the same path, or an entry name illegal on the OS (Windows reserved names/characters).","commonSituations":"Re-extracting over a dirty target dir where files replaced directories; insufficient permissions in the install dir; Windows reserved names like `CON`, `PRN`, or `:` in entry names; disk full.","solutions":["Check the exact path in the message with ls/dir — remove any regular file squatting on a directory path","Extract into a new empty directory instead of reusing one","Fix permissions or free disk space on the target volume","On Windows, verify the zip does not contain OS-illegal names"],"exampleFix":"// before\nCompressionUtils.extractZipFileWithPermissions(zip, existingDirtyDir);\n\n// after\nFile clean = Files.createTempDirectory(\"unzip\").toFile();\nCompressionUtils.extractZipFileWithPermissions(zip, clean.getAbsolutePath());","handlingStrategy":"validation","validationCode":"File target = new File(targetPath);\nif (target.exists() && !target.isDirectory()) throw new IOException(target + \" is a file\");\nif (!target.exists() && !target.mkdirs()) throw new IOException(\"Cannot create \" + target);","typeGuard":null,"tryCatchPattern":"catch (IOException e) around extractZipFileWithPermissions and rethrow including the absolute failing path.","preventionTips":["Always unzip into a fresh directory; re-extraction into used dirs is unsupported","Check disk space and permissions before large extractions"],"tags":["flink-core","compression","zip","filesystem","permissions"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}