{"record":{"id":"ff38d3a28e47421e","repo":"eclipse-vertx/vert.x","slug":"failed-to-create-subfolder-of-parentdir","errorCode":null,"errorMessage":"Failed to create subfolder of ${parentDir}","messagePattern":"Failed to create subfolder of (.+?)","errorType":"exception","errorClass":"FileSystemException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java","lineNumber":766,"sourceCode":"        try {\n          Path tmpDir;\n          if (parentDir != null) {\n            Path dir = resolveFile(parentDir).toPath();\n            if (attrs != null) {\n              tmpDir = Files.createTempDirectory(dir, prefix, attrs);\n            } else {\n              tmpDir = Files.createTempDirectory(dir, prefix);\n            }\n          } else {\n            if (attrs != null) {\n              tmpDir = Files.createTempDirectory(prefix, attrs);\n            } else {\n              tmpDir = Files.createTempDirectory(prefix);\n            }\n          }\n          return tmpDir.toFile().getAbsolutePath();\n        } catch (IOException e) {\n          throw new FileSystemException(getFolderAccessErrorMessage(\"create subfolder of\", parentDir), e);\n        }\n      }\n    };\n  }\n\n  protected BlockingAction<String> createTempFileInternal(String parentDir, String prefix, String suffix, String perms) {\n    FileAttribute<?> attrs = perms == null ? null : PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString(perms));\n    return new BlockingAction<String>() {\n      public String perform() {\n        try {\n          Path tmpFile;\n          if (parentDir != null) {\n            Path dir = resolveFile(parentDir).toPath();\n            if (attrs != null) {\n              tmpFile = Files.createTempFile(dir, prefix, suffix, attrs);\n            } else {\n              tmpFile = Files.createTempFile(dir, prefix, suffix);\n            }","sourceCodeStart":748,"sourceCodeEnd":784,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java#L748-L784","documentation":"Thrown when FileSystem.createTempDirectory fails: Vert.x calls Files.createTempDirectory (in parentDir when given, with POSIX attrs for perms) and wraps IOException into a FileSystemException via getFolderAccessErrorMessage(\"create subfolder of\", parentDir) — 'Failed to create subfolder of <parentDir>'. The temporary directory could not be created at the requested location.","triggerScenarios":"vertx.fileSystem().createTempDirectory(dir, prefix, suffix, perms) when parentDir does not exist, is not writable, or (with no dir) the java.io.tmpdir location is unavailable or full.","commonSituations":"Passing a non-existent parentDir instead of null; read-only /tmp in containers (or tmpfs full); java.io.tmpdir pointing to a directory the process user cannot write; SELinux/AppArmor blocking temp creation.","solutions":["Ensure parentDir exists and is writable, or pass null to use the system temp dir.","Check disk space on the temp filesystem (df -h /tmp).","Set -Djava.io.tmpdir to a writable location if the default is not writable.","Inspect getCause() for AccessDeniedException vs FileSystemException (no space)."],"exampleFix":"// before\nvertx.fileSystem().createTempDirectoryBlocking(\"/app/tmp\", \"work-\", \".d\", null); // /app/tmp missing\n// after\nvertx.fileSystem().mkdirsBlocking(\"/app/tmp\");\nvertx.fileSystem().createTempDirectoryBlocking(\"/app/tmp\", \"work-\", \".d\", null);","handlingStrategy":"try-catch","validationCode":"if (parentDir != null && (!vertx.fileSystem().existsBlocking(parentDir) || !vertx.fileSystem().propsBlocking(parentDir).isDirectory())) throw new IllegalArgumentException(\"bad temp parent: \" + parentDir);","typeGuard":null,"tryCatchPattern":"try { return vertx.fileSystem().createTempDirectoryBlocking(parentDir, prefix, suffix, perms); } catch (FileSystemException e) { log.error(\"temp dir creation failed in {}: {}\", parentDir, e.getCause(), e); throw e; }","preventionTips":["Pass null to use the default temp dir unless you need a specific one","Ensure java.io.tmpdir points to a writable, non-full filesystem","Create parentDir with mkdirs before creating temp dirs in it","Monitor disk space on temp volumes"],"tags":["filesystem","temp-directory","io","tmpdir"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}