{"record":{"id":"fd37f2f4e66c6ac4","repo":"eclipse-vertx/vert.x","slug":"failed-to-chmod-path","errorCode":null,"errorMessage":"Failed to chmod ${path}","messagePattern":"Failed to chmod (.+?)","errorType":"exception","errorClass":"FileSystemException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java","lineNumber":549,"sourceCode":"              public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {\n                //The directory entries typically have different permissions to the files, e.g. execute permission\n                //or can't cd into it\n                Files.setPosixFilePermissions(dir, dirPermissions);\n                return FileVisitResult.CONTINUE;\n              }\n\n              public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {\n                Files.setPosixFilePermissions(file, permissions);\n                return FileVisitResult.CONTINUE;\n              }\n            });\n          } else {\n            Files.setPosixFilePermissions(target, permissions);\n          }\n        } catch (SecurityException e) {\n          throw new FileSystemException(\"Accessed denied for chmod on \" + path);\n        } catch (IOException e) {\n          throw new FileSystemException(getFileAccessErrorMessage(\"chmod\", path), e);\n        }\n        return null;\n      }\n    };\n  }\n\n  protected BlockingAction<Void> chownInternal(String path, String user, String group) {\n    Objects.requireNonNull(path);\n    return new BlockingAction<Void>() {\n      public Void perform() {\n        try {\n          Path target = resolveFile(path).toPath();\n          UserPrincipalLookupService service = target.getFileSystem().getUserPrincipalLookupService();\n          UserPrincipal userPrincipal = user == null ? null : service.lookupPrincipalByName(user);\n          GroupPrincipal groupPrincipal = group == null ? null : service.lookupPrincipalByGroupName(group);\n          if (groupPrincipal != null) {\n            PosixFileAttributeView view = Files.getFileAttributeView(target, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);\n            if (view == null) {","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java#L531-L567","documentation":"Vert.x wraps the java.nio.file.IOException thrown by Files.setPosixFilePermissions during FileSystem.chmod into a FileSystemException. It means the POSIX permission bits of the target path could not be changed. SecurityException yields a separate 'Accessed denied' variant; this one covers all other I/O failures such as a missing file or a filesystem that does not support POSIX permissions.","triggerScenarios":"Calling vertx.fileSystem().chmod(path, perms) (or chmodBlocking) when the path does not exist, the path is on a non-POSIX filesystem (e.g. Windows FAT, some network mounts), or the underlying Files.setPosixFilePermissions call raises IOException.","commonSituations":"Typo in the path passed to chmod; running inside a container where the mounted volume does not support chmod; chmod on a Windows filesystem; race where the file is deleted between check and chmod.","solutions":["Verify the path exists (vertx.fileSystem().existsBlocking(path)) before chmod.","Confirm the filesystem supports POSIX permissions; skip chmod or use ACLs on non-POSIX volumes.","Check the nested cause (FileSystemException.getCause()) for the exact IOException reason.","Ensure the process user has ownership of the file; PermissionDenied surfaces as the separate SecurityException variant."],"exampleFix":"// before\nvertx.fileSystem().chmod(\"/app/conf\", \"rwxr-x---\");\n// after\nvertx.fileSystem().exists(\"/app/conf\").onSuccess(ok -> {\n  if (ok) vertx.fileSystem().chmod(\"/app/conf\", \"rwxr-x---\");\n});","handlingStrategy":"try-catch","validationCode":"if (!vertx.fileSystem().existsBlocking(path)) throw new IllegalStateException(\"cannot chmod missing path: \" + path);","typeGuard":null,"tryCatchPattern":"try { vertx.fileSystem().chmodBlocking(path, perms); } catch (FileSystemException e) { log.error(\"chmod failed for {}: {}\", path, e.getCause(), e); }","preventionTips":["Check existence before chmod","Only chmod on POSIX filesystems","Always inspect getCause() for the real IOException","Ensure the process user owns the target"],"tags":["filesystem","chmod","posix","io"],"backgroundTag":"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"}