apache/flink · error · IOException
Create file: {outputFile.getAbsolutePath()} failed!
Error message
Create file: {outputFile.getAbsolutePath()} failed! What it means
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.
Source
Thrown at flink-core/src/main/java/org/apache/flink/util/CompressionUtils.java:258
} else {
File parentDir = outputFile.getParentFile();
if (!parentDir.exists()) {
if (!parentDir.mkdirs()) {
throw new IOException(
"Create dir: " + outputFile.getAbsolutePath() + " failed!");
}
}
if (entry.isUnixSymlink()) {
// the content of the file is the target path of the symlink
baos.reset();
IOUtils.copyBytes(zipFile.getInputStream(entry), baos);
Files.createSymbolicLink(
outputFile.toPath(), new File(parentDir, baos.toString()).toPath());
} else if (outputFile.createNewFile()) {
OutputStream output = new FileOutputStream(outputFile);
IOUtils.copyBytes(zipFile.getInputStream(entry), output);
} else {
throw new IOException(
"Create file: " + outputFile.getAbsolutePath() + " failed!");
}
}
if (isUnix) {
int mode = entry.getUnixMode();
if (mode != 0) {
Path outputPath = Paths.get(outputFile.toURI());
Set<PosixFilePermission> permissions = new HashSet<>();
addIfBitSet(mode, 8, permissions, PosixFilePermission.OWNER_READ);
addIfBitSet(mode, 7, permissions, PosixFilePermission.OWNER_WRITE);
addIfBitSet(mode, 6, permissions, PosixFilePermission.OWNER_EXECUTE);
addIfBitSet(mode, 5, permissions, PosixFilePermission.GROUP_READ);
addIfBitSet(mode, 4, permissions, PosixFilePermission.GROUP_WRITE);
addIfBitSet(mode, 3, permissions, PosixFilePermission.GROUP_EXECUTE);
addIfBitSet(mode, 2, permissions, PosixFilePermission.OTHERS_READ);
addIfBitSet(mode, 1, permissions, PosixFilePermission.OTHERS_WRITE);
addIfBitSet(mode, 0, permissions, PosixFilePermission.OTHERS_EXECUTE);
// the permission of the target file will be set to be the same as theView on GitHub (pinned to 2f3c205e92)
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
Example fix
// before CompressionUtils.extractZipFileWithPermissions(zip, targetDir); // second run -> throws // after FileUtils.deleteDirectory(targetDir); // start clean CompressionUtils.extractZipFileWithPermissions(zip, targetDir);
Defensive patterns
Strategy: validation
Validate before calling
File target = new File(targetPath);
if (target.exists() && target.list() != null && target.list().length > 0) {
throw new IOException("Target not empty: " + target + " - extract into a clean dir");
} Try / catch
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.
Prevention
- Delete or use a unique target directory for every extraction run
- Reject zips with duplicate entry names when accepting archives from outside
When it happens
Trigger: 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.
Common situations: Re-running extraction into a non-empty target with the same Flink distribution/plugin zip; zips with duplicated entries; sandboxed environments denying file creation.
Related errors
- Create dir: {outputFile.getAbsolutePath()} failed!
- Mkdirs failed to create {targetDir}
- Failed to create directory {outputFile}
- Mkdirs failed to create tar internal dir {targetDir}
- Expand {entry.getName()} would create a file outside of {tar
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/fad810cbb0173f7d.
Report an issue: GitHub.