apache/seatunnel · error · IllegalStateException
Couldn't create directory %s.
Error message
Couldn't create directory %s.
What it means
During tar extraction, unTar calls mkdirs() to create each directory entry and throws IllegalStateException('Couldn't create directory %s.') when mkdirs() returns false, i.e. the directory could not be created on the filesystem.
Source
Thrown at seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/CompressionUtils.java:128
final TarArchiveInputStream debInputStream =
(TarArchiveInputStream)
new ArchiveStreamFactory().createArchiveInputStream("tar", is)) {
TarArchiveEntry entry = null;
while ((entry = (TarArchiveEntry) debInputStream.getNextEntry()) != null) {
final File outputFile = new File(outputDir, entry.getName());
if (!outputFile.toPath().normalize().startsWith(outputDir.toPath())) {
throw new IllegalStateException("Bad zip entry");
}
if (entry.isDirectory()) {
log.info(
"Attempting to write output directory {}.",
outputFile.getAbsolutePath());
if (!outputFile.exists()) {
log.info(
"Attempting to create output directory {}.",
outputFile.getAbsolutePath());
if (!outputFile.mkdirs()) {
throw new IllegalStateException(
String.format(
"Couldn't create directory %s.",
outputFile.getAbsolutePath()));
}
}
} else {
log.info("Creating output file {}.", outputFile.getAbsolutePath());
final OutputStream outputFileStream = new FileOutputStream(outputFile);
IOUtils.copy(debInputStream, outputFileStream);
outputFileStream.close();
}
untaredFiles.add(outputFile);
}
}
}
/**
* Ungzip an input file into an output file.View on GitHub (pinned to cf67b549a7)
Solutions
- Check outputDir permissions and ensure the process user can write there
- Remove any file that occupies a path where a directory must be created
- Verify disk space and that the filesystem is writable, then retry
Example fix
// before
CompressionUtils.unTar(archive, new File("/opt/seatunnel/connectors"));
// after
File dir = new File("/opt/seatunnel/connectors");
if (dir.exists() && !dir.isDirectory()) { dir.delete(); }
dir.mkdirs();
if (!dir.canWrite()) { throw new IllegalStateException("No write permission: " + dir); }
CompressionUtils.unTar(archive, dir); Defensive patterns
Strategy: validation
Validate before calling
File dir = new File(outputPath); if (dir.exists() && !dir.isDirectory()) throw new IllegalStateException("Not a directory: " + dir); if (!dir.canWrite()) throw new IllegalStateException("Not writable: " + dir); Try / catch
try { CompressionUtils.unTar(archive, dir); } catch (IllegalStateException e) { log.error("Extraction failed: {}", e.getMessage()); } Prevention
- Ensure the process user owns or can write the target directory
- Clean up partial extractions before retrying
- Check free disk space and read-only mounts
When it happens
Trigger: mkdirs() fails because the parent path exists as a file, the process lacks write permission on outputDir, or the filesystem is full/read-only.
Common situations: Extracting plugins into a directory owned by another user, running in a read-only container filesystem, or a prior failed extraction left a file where a directory is expected.
Understand the failure class
Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.
Related errors
- create(): Mkdirs failed to create: ${parent}
- Failed to change working directory to %s, FTP reply code: %d
- python.executable does not resolve to an executable file: {}
- Circular condition chain detected: '%s' already exists in th
- Condition for option '%s' has a null operator
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/79617b8a08703bd7.
Report an issue: GitHub.