{"record":{"id":"118132efada2f8cf","repo":"eclipse-vertx/vert.x","slug":"failed-to-crown-path","errorCode":null,"errorMessage":"Failed to crown ${path}","messagePattern":"Failed to crown (.+?)","errorType":"exception","errorClass":"FileSystemException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java","lineNumber":579,"sourceCode":"          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) {\n              throw new FileSystemException(\"Change group of file not supported\");\n            }\n            view.setGroup(groupPrincipal);\n\n          }\n          if (userPrincipal != null) {\n            Files.setOwner(target, userPrincipal);\n          }\n        } catch (SecurityException e) {\n          throw new FileSystemException(\"Accessed denied for chown on \" + path);\n        } catch (IOException e) {\n          throw new FileSystemException(getFileAccessErrorMessage(\"crown\", path), e);\n        }\n        return null;\n      }\n    };\n  }\n\n  private BlockingAction<FileProps> propsInternal(String path) {\n    return props(path, true);\n  }\n\n  private BlockingAction<FileProps> lpropsInternal(String path) {\n    return props(path, false);\n  }\n\n  private BlockingAction<FileProps> props(String path, boolean followLinks) {\n    Objects.requireNonNull(path);\n    return new BlockingAction<FileProps>() {\n      public FileProps perform() {","sourceCodeStart":561,"sourceCodeEnd":597,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java#L561-L597","documentation":"Vert.x wraps the IOException thrown by Files.setOwner or principal lookup during FileSystem.chown into this FileSystemException (note the 'crown' wording comes from the internal getFileAccessErrorMessage(\"crown\", path) call — a typo for 'chown'). It means the owner could not be changed for an I/O reason, not a security refusal.","triggerScenarios":"Calling vertx.fileSystem().chown(path, user, group) when the path does not exist, the user/group principal name cannot be resolved by UserPrincipalLookupService (UserPrincipalNotFoundException extends IOException), or the filesystem does not support ownership.","commonSituations":"Misspelled username passed to chown; chown on a Windows or network filesystem that has no owner attribute; path deleted before the blocking action runs.","solutions":["Check the cause: UserPrincipalNotFoundException means the user/group name is wrong — fix the name.","Verify the path exists before chown (existsBlocking).","On non-POSIX filesystems, skip chown and rely on volume-level ACL configuration.","Inspect the nested IOException via getCause() for the precise failure."],"exampleFix":"// before\nvertx.fileSystem().chown(\"/app/data\", \"apuser\", null); // typo -> UserPrincipalNotFoundException\n// after\nvertx.fileSystem().chown(\"/app/data\", \"appuser\", null);","handlingStrategy":"try-catch","validationCode":"if (!vertx.fileSystem().existsBlocking(path)) throw new IllegalStateException(\"missing path: \" + path);\n// also validate user/group names are resolvable on the host","typeGuard":null,"tryCatchPattern":"try { vertx.fileSystem().chownBlocking(path, user, group); } catch (FileSystemException e) { Throwable c = e.getCause(); if (c instanceof UserPrincipalNotFoundException) { throw new IllegalArgumentException(\"unknown user/group: \" + user + \"/\" + group); } throw e; }","preventionTips":["Verify usernames exist on the host (getent passwd)","Check path existence before chown","Skip ownership changes on non-POSIX filesystems","Log getCause() to distinguish name resolution from I/O errors"],"tags":["filesystem","chown","io","principal"],"backgroundTag":"file-write-failed","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"}