{"record":{"id":"fad810cbb0173f7d","repo":"apache/flink","slug":"create-file-outputfile-getabsolutepath-failed","errorCode":null,"errorMessage":"Create file: {outputFile.getAbsolutePath()} failed!","messagePattern":"Create file: (.+?) failed!","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/CompressionUtils.java","lineNumber":258,"sourceCode":"                } 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()) {\n                        OutputStream output = new FileOutputStream(outputFile);\n                        IOUtils.copyBytes(zipFile.getInputStream(entry), output);\n                    } else {\n                        throw new IOException(\n                                \"Create file: \" + outputFile.getAbsolutePath() + \" failed!\");\n                    }\n                }\n                if (isUnix) {\n                    int mode = entry.getUnixMode();\n                    if (mode != 0) {\n                        Path outputPath = Paths.get(outputFile.toURI());\n                        Set<PosixFilePermission> permissions = new HashSet<>();\n                        addIfBitSet(mode, 8, permissions, PosixFilePermission.OWNER_READ);\n                        addIfBitSet(mode, 7, permissions, PosixFilePermission.OWNER_WRITE);\n                        addIfBitSet(mode, 6, permissions, PosixFilePermission.OWNER_EXECUTE);\n                        addIfBitSet(mode, 5, permissions, PosixFilePermission.GROUP_READ);\n                        addIfBitSet(mode, 4, permissions, PosixFilePermission.GROUP_WRITE);\n                        addIfBitSet(mode, 3, permissions, PosixFilePermission.GROUP_EXECUTE);\n                        addIfBitSet(mode, 2, permissions, PosixFilePermission.OTHERS_READ);\n                        addIfBitSet(mode, 1, permissions, PosixFilePermission.OTHERS_WRITE);\n                        addIfBitSet(mode, 0, permissions, PosixFilePermission.OTHERS_EXECUTE);\n                        // the permission of the target file will be set to be the same as the","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/CompressionUtils.java#L240-L276","documentation":"Thrown when File.createNewFile() returns false for a zip file entry — the file could not be created because it already exists (createNewFile refuses to overwrite) or permission denies creation. Note the message reports the entry file's path even when the cause is the parent directory.","triggerScenarios":"Extracting a zip that contains duplicate entry names, or extracting over a directory where the file already exists (createNewFile does not truncate); also plain permission failures on creation.","commonSituations":"Re-running extraction into a non-empty target with the same Flink distribution/plugin zip; zips with duplicated entries; sandboxed environments denying file creation.","solutions":["Extract into a clean/empty target directory (the standard fix — re-extraction into a used dir is not supported)","Check for duplicate entries in the zip (`unzip -l | sort | uniq -d`) and rebuild the archive","Confirm create/write permission on the target directory"],"exampleFix":"// before\nCompressionUtils.extractZipFileWithPermissions(zip, targetDir); // second run -> throws\n\n// after\nFileUtils.deleteDirectory(targetDir); // start clean\nCompressionUtils.extractZipFileWithPermissions(zip, targetDir);","handlingStrategy":"validation","validationCode":"File target = new File(targetPath);\nif (target.exists() && target.list() != null && target.list().length > 0) {\n    throw new IOException(\"Target not empty: \" + target + \" - extract into a clean dir\");\n}","typeGuard":null,"tryCatchPattern":"catch (IOException e) around extraction; if the message is 'Create file: ... failed!' and the file exists, treat as re-extraction into a dirty target and clean/retry once.","preventionTips":["Delete or use a unique target directory for every extraction run","Reject zips with duplicate entry names when accepting archives from outside"],"tags":["flink-core","compression","zip","filesystem","idempotency"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}