{"record":{"id":"659d019a90d6b7a9","repo":"juicedata/juicefs","slug":"construct-filestatus-failed","errorCode":null,"errorMessage":"construct fileStatus failed","messagePattern":"construct fileStatus failed","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":1778,"sourceCode":"    boolean isdir = ((mode >>> 31) & 1) == 1; // Go\n    int stickybit = (mode >>> 20) & 1;\n    boolean hasAcl = (mode >> 18 & 1) == 1;\n    FsPermission perm = new FsPermission((short) ((mode & 0777) | (stickybit << 9)));\n    perm = new FsPermissionExtension(perm, hasAcl, false);\n    long length = buf.getLongLong(4);\n    long mtime = buf.getLongLong(12);\n    long atime = buf.getLongLong(20);\n    String user = buf.getString(28);\n    String group = buf.getString(28 + user.length() + 1);\n    assert (30 + user.length() + group.length() == size);\n\n    if (fileStatusConstructor == null) {\n      return new FileStatus(length, isdir, 1, blocksize, mtime, atime, perm, user, group, p);\n    } else {\n      try {\n        return fileStatusConstructor.newInstance(length, isdir, 1, blocksize, mtime, atime, perm, user, group, null, p, hasAcl, false, false);\n      } catch (Exception e) {\n        throw new IOException(\"construct fileStatus failed\", e);\n      }\n    }\n  }\n\n  @Override\n  public FileStatus[] listStatus(Path f) throws IOException {\n    if (needCheckPermission() && !checkPathAccess(f, FsAction.READ_EXECUTE, \"listStatus\")) {\n      return superGroupFileSystem.listStatus(f);\n    }\n    statistics.incrementReadOps(1);\n    int bufsize = 32 << 10;\n    Pointer buf = Memory.allocate(Runtime.getRuntime(lib), bufsize); // TODO: smaller buff\n    String path = normalizePath(f);\n    int r = lib.jfs_listdir(Thread.currentThread().getId(), handle, path, 0, buf, bufsize);\n    if (r == ENOENT) {\n      throw new FileNotFoundException(f.toString());\n    }\n    if (r == ENOTDIR) {","sourceCodeStart":1760,"sourceCodeEnd":1796,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L1760-L1796","documentation":"Raised while building a FileStatus via reflection when the 13-arg constructor (with ACL fields, used on newer Hadoop versions) throws. JuiceFS tries a Hadoop-3.x-specific FileStatus constructor first; if instantiation fails (signature mismatch or inner error) it wraps the cause in an IOException.","triggerScenarios":"Running against a Hadoop version whose FileStatus constructor signature differs from what was resolved reflectively; the resolved constructor throws while validating arguments (e.g. null path or permission incompatible with the Hadoop build).","commonSituations":"Hadoop-version mismatch: jar built/tested against Hadoop 2 but deployed on Hadoop 3 (or vice versa) so reflective resolution picks a wrong constructor; shaded/relocated Hadoop classes on the classpath.","solutions":["Align the JuiceFS Hadoop SDK version with the cluster's Hadoop version","Check the wrapped cause (getCause()) to see the real constructor failure","Ensure no conflicting/shaded org.apache.hadoop classes shadow the real ones","Report upstream if the constructor resolution logic needs to cover your Hadoop version"],"exampleFix":"// pom.xml before\n<hadoop.version>2.7.3</hadoop.version>\n// after — match deployment cluster\n<hadoop.version>3.3.4</hadoop.version>","handlingStrategy":"try-catch","validationCode":"// verify Hadoop version: org.apache.hadoop.util.VersionInfo.getVersion() matches your SDK build","typeGuard":null,"tryCatchPattern":"try { FileStatus st = getFileStatus(path); } catch (IOException e) { if (e.getMessage().equals(\"construct fileStatus failed\")) { log.error(\"Hadoop version mismatch\", e.getCause()); } throw e; }","preventionTips":["Match the juicefs-hadoop jar to the cluster Hadoop major version","Inspect getCause() for the reflective instantiation error","Avoid shaded Hadoop classes on the classpath","Test listStatus/getFileStatus after any Hadoop upgrade"],"tags":["java","hadoop","reflection","version-compat"],"backgroundTag":"invalid-constructor-argument","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}