{"record":{"id":"fa3b0f1ca7c25b46","repo":"apache/hadoop","slug":"the-ownership-on-the-staging-directory-stagingar-fa3b0f","errorCode":null,"errorMessage":"The ownership on the staging directory ${stagingArea} is not as expected. It is owned by ${fileOwner}. The directory must be owned by the submitter ${currentUser.getShortUserName()} or ${currentUser.getUserName()}","messagePattern":"The ownership on the staging directory (.+?) is not as expected\\. It is owned by (.+?)\\. The directory must be owned by the submitter (.+?) or (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmissionFiles.java","lineNumber":152,"sourceCode":"    UserGroupInformation currentUser = realUser.getCurrentUser();\n    try {\n      FileStatus fsStatus = fs.getFileStatus(stagingArea);\n      String fileOwner = fsStatus.getOwner();\n      if (!(fileOwner.equals(currentUser.getShortUserName()) || fileOwner\n          .equalsIgnoreCase(currentUser.getUserName()) || fileOwner\n          .equals(realUser.getShortUserName()) || fileOwner\n          .equalsIgnoreCase(realUser.getUserName()))) {\n        String errorMessage = \"The ownership on the staging directory \" +\n            stagingArea + \" is not as expected. \" +\n            \"It is owned by \" + fileOwner + \". The directory must \" +\n            \"be owned by the submitter \" + currentUser.getShortUserName()\n            + \" or \" + currentUser.getUserName();\n        if (!realUser.getUserName().equals(currentUser.getUserName())) {\n          throw new IOException(\n              errorMessage + \" or \" + realUser.getShortUserName() + \" or \"\n                  + realUser.getUserName());\n        } else {\n          throw new IOException(errorMessage);\n        }\n      }\n      if (!fsStatus.getPermission().equals(JOB_DIR_PERMISSION)) {\n        LOG.info(\"Permissions on staging directory \" + stagingArea + \" are \" +\n            \"incorrect: \" + fsStatus.getPermission() + \". Fixing permissions \" +\n            \"to correct value \" + JOB_DIR_PERMISSION);\n        fs.setPermission(stagingArea, JOB_DIR_PERMISSION);\n      }\n    } catch (FileNotFoundException e) {\n      FileSystem.mkdirs(fs, stagingArea, new FsPermission(JOB_DIR_PERMISSION));\n    }\n    return stagingArea;\n  }\n}\n","sourceCodeStart":134,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmissionFiles.java#L134-L167","documentation":"Error \"The ownership on the staging directory ${stagingArea} is not as expected. It is owned by ${fileOwner}. The directory must be owned by the submitter ${currentUser.getShortUserName()} or ${currentUser.getUserName()}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmissionFiles.java:152 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the staging directory owner to the submitting user, or submit the job as the user that owns the directory."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}