{"record":{"id":"10751d4f655e6663","repo":"eclipse-vertx/vert.x","slug":"failed-to-read-p","errorCode":null,"errorMessage":"Failed to read ${p}","messagePattern":"Failed to read (.+?)","errorType":"exception","errorClass":"FileSystemException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java","lineNumber":843,"sourceCode":"                }\n              };\n            } else {\n              fnFilter = null;\n            }\n            File[] files;\n            if (fnFilter == null) {\n              files = file.listFiles();\n            } else {\n              files = file.listFiles(fnFilter);\n            }\n            List<String> ret = new ArrayList<>(files.length);\n            for (File f : files) {\n              ret.add(f.getCanonicalPath());\n            }\n            return ret;\n          }\n        } catch (IOException e) {\n          throw new FileSystemException(getFolderAccessErrorMessage(\"read\", p), e);\n        }\n      }\n    };\n  }\n\n  private BlockingAction<Buffer> readFileInternal(String path) {\n    Objects.requireNonNull(path);\n    return new BlockingAction<Buffer>() {\n      public Buffer perform() {\n        try {\n          Path target = resolveFile(path).toPath();\n          try (FileChannel fc = FileChannel.open(target, StandardOpenOption.READ)) {\n            long size = fc.size();\n            if (size > (long) Integer.MAX_VALUE) {\n              // Throwing OOM as Files#readAllLines would in this case\n              throw new OutOfMemoryError(\"File is too big\");\n            }\n            int len = (int) size;","sourceCodeStart":825,"sourceCodeEnd":861,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java#L825-L861","documentation":"Wrapped error in readDirInternal: listing the directory's files (File.listFiles with or without a filter) or resolving canonical paths threw an IOException. The message names the read operation and the raw path; the concrete cause is attached. Note listFiles returning null (unreadable dir) can also surface as an NPE/IO failure here.","triggerScenarios":"Calling FileSystem.readDir(path) when the OS refuses or interrupts directory access — permission issues, I/O errors, or failure to canonicalize paths of entries.","commonSituations":"Directory readable via metadata but unreadable in practice (NFS stale handles, removed while iterating, SELinux/AppArmor denial), or the process losing read permission between the exists() check and the listing.","solutions":["Check the cause chain for the underlying I/O problem","Verify the directory is readable and not a special filesystem entry","Handle a null/empty listing gracefully"],"exampleFix":"// before (permission denied on /secure)\nvertx.fileSystem().readDir(\"/secure\");\n// after\nchmod o+rx /secure  # grant read/execute to the process user\nvertx.fileSystem().readDir(\"/secure\");","handlingStrategy":"try-catch","validationCode":"File dir = new File(path);\nif (!dir.canRead() || !dir.canExecute()) {\n  throw new IllegalStateException(\"No read access to directory: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n  fs.readDir(path);\n} catch (FileSystemException e) {\n  Throwable cause = e.getCause();\n  if (cause instanceof IOException) {\n    // inspect cause, retry once on transient NFS/IO errors\n  }\n}","preventionTips":["Grant the service account read+execute on target directories","Watch for stale NFS handles / files removed mid-listing","Check SELinux/AppArmor denials in audit logs"],"tags":["filesystem","io","directory"],"backgroundTag":"file-read-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"}