{"record":{"id":"79617b8a08703bd7","repo":"apache/seatunnel","slug":"couldn-t-create-directory-s","errorCode":null,"errorMessage":"Couldn't create directory %s.","messagePattern":"Couldn't create directory (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/CompressionUtils.java","lineNumber":128,"sourceCode":"                final TarArchiveInputStream debInputStream =\n                        (TarArchiveInputStream)\n                                new ArchiveStreamFactory().createArchiveInputStream(\"tar\", is)) {\n            TarArchiveEntry entry = null;\n            while ((entry = (TarArchiveEntry) debInputStream.getNextEntry()) != null) {\n                final File outputFile = new File(outputDir, entry.getName());\n                if (!outputFile.toPath().normalize().startsWith(outputDir.toPath())) {\n                    throw new IllegalStateException(\"Bad zip entry\");\n                }\n                if (entry.isDirectory()) {\n                    log.info(\n                            \"Attempting to write output directory {}.\",\n                            outputFile.getAbsolutePath());\n                    if (!outputFile.exists()) {\n                        log.info(\n                                \"Attempting to create output directory {}.\",\n                                outputFile.getAbsolutePath());\n                        if (!outputFile.mkdirs()) {\n                            throw new IllegalStateException(\n                                    String.format(\n                                            \"Couldn't create directory %s.\",\n                                            outputFile.getAbsolutePath()));\n                        }\n                    }\n                } else {\n                    log.info(\"Creating output file {}.\", outputFile.getAbsolutePath());\n                    final OutputStream outputFileStream = new FileOutputStream(outputFile);\n                    IOUtils.copy(debInputStream, outputFileStream);\n                    outputFileStream.close();\n                }\n                untaredFiles.add(outputFile);\n            }\n        }\n    }\n\n    /**\n     * Ungzip an input file into an output file.","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/CompressionUtils.java#L110-L146","documentation":"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.","triggerScenarios":"mkdirs() fails because the parent path exists as a file, the process lacks write permission on outputDir, or the filesystem is full/read-only.","commonSituations":"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.","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"],"exampleFix":"// before\nCompressionUtils.unTar(archive, new File(\"/opt/seatunnel/connectors\"));\n// after\nFile dir = new File(\"/opt/seatunnel/connectors\");\nif (dir.exists() && !dir.isDirectory()) { dir.delete(); }\ndir.mkdirs();\nif (!dir.canWrite()) { throw new IllegalStateException(\"No write permission: \" + dir); }\nCompressionUtils.unTar(archive, dir);","handlingStrategy":"validation","validationCode":"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);","typeGuard":null,"tryCatchPattern":"try { CompressionUtils.unTar(archive, dir); } catch (IllegalStateException e) { log.error(\"Extraction failed: {}\", e.getMessage()); }","preventionTips":["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"],"tags":["filesystem","mkdir","permissions"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}