{"record":{"id":"74e4beb0628b4417","repo":"juicedata/juicefs","slug":"invalid-parameter","errorCode":null,"errorMessage":"Invalid parameter","messagePattern":"Invalid parameter","errorType":"exception","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java","lineNumber":656,"sourceCode":"    Pointer buf = null;\n    while (r > size) {\n      size = r;\n      buf = Memory.allocate(Runtime.getRuntime(lib), size);\n      r = lib.jfs_getGroups(name, user, buf, size);\n    }\n    if (r == 0) {\n      return new HashSet<>(ugi.getGroups());\n    }\n    byte[] rBuf = new byte[r];\n    buf.get(0, rBuf, 0, r);\n\n    return new HashSet<>(Arrays.asList(new String(rBuf).split(\",\")));\n  }\n\n  private boolean isSuperUser() throws IOException {\n    int r = lib.jfs_is_superuser(handle, user, String.join(\",\",  getGroups()));\n    if (r < 0) {\n      throw new InvalidRequestException(\"Invalid parameter\");\n    }\n    return r == 1;\n  }\n\n  private boolean needCheckPermission() throws IOException {\n    return rangerPermissionChecker != null && !isSuperGroupFileSystem && !isBackGroundTask && !isSuperUser() ;\n  }\n\n  private boolean checkPathAccess(Path path, FsAction action, String operation) throws IOException {\n    return rangerPermissionChecker.checkPermission(path, false, null, null, action, operation, user, getGroups());\n  }\n\n  private boolean checkParentPathAccess(Path path, FsAction action, String operation) throws IOException {\n    return rangerPermissionChecker.checkPermission(path, false, null, action, null, operation, user, getGroups());\n  }\n\n  private boolean checkAncestorAccess(Path path, FsAction action, String operation) throws IOException {\n    return rangerPermissionChecker.checkPermission(path, false, action, null, null, operation, user, getGroups());","sourceCodeStart":638,"sourceCodeEnd":674,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java#L638-L674","documentation":"isSuperUser() calls the native jfs_is_superuser with the current user and groups. A negative return signals the request itself was invalid (most commonly an invalid/uninitialized filesystem handle or bad parameter), and the code throws InvalidRequestException('Invalid parameter') instead of treating the user as non-super.","triggerScenarios":"Calling a permission-sensitive operation while needCheckPermission() is true (Ranger checker active, not super-group FS, not a background task) and jfs_is_superuser returns < 0 — e.g. the filesystem handle was closed/failed to initialize.","commonSituations":"The volume failed to initialize earlier but the FS object is still used; user/groups resolution fails so the native call gets unusable input; concurrent close of the filesystem while a permission check runs.","solutions":["Check earlier logs for a failed jfs_init or handle closure; re-create the FileSystem instance.","Verify the Hadoop user and group resolution (UGI) works on the node.","Ensure the juicefs-hadoop client version matches the native library version to avoid ABI mismatches.","If Ranger is enabled, confirm the Ranger config initialized correctly so the handle is valid."],"exampleFix":"// before\nFileSystem fs = FileSystem.get(uri, conf); // init failed earlier, handle <= 0 reused\nfs.listStatus(path); // -> InvalidRequestException: Invalid parameter\n// after\nif (fs instanceof JuiceFileSystemImpl) ((JuiceFileSystemImpl) fs).getHandle() > 0; // or catch and re-init\nfs.listStatus(path);","handlingStrategy":"try-catch","validationCode":"// ensure the FS initialized successfully and is open before permission-sensitive ops\nif (fs instanceof JuiceFileSystemImpl) {\n  ((JuiceFileSystemImpl) fs).getHandle(); // > 0 required; re-init otherwise\n}","typeGuard":null,"tryCatchPattern":"try { fs.listStatus(path); } catch (InvalidRequestException e) { if (\"Invalid parameter\".equals(e.getMessage())) { fs.close(); fs = FileSystem.get(uri, conf); fs.listStatus(path); } else throw e; }","preventionTips":["Fix any earlier init failures rather than reusing a broken FS instance.","Keep client jar and native lib versions matched.","Avoid closing FileSystem instances concurrently with in-flight operations.","Verify UGI user/group resolution on worker nodes."],"tags":["native-library","permissions","ranger"],"backgroundTag":"invalid-argument","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}