{"record":{"id":"39098dc9a82aba07","repo":"apache/hadoop","slug":"permission-denied","errorCode":null,"errorMessage":"Permission denied","messagePattern":"Permission denied","errorType":"exception","errorClass":"AccessDeniedException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java","lineNumber":1621,"sourceCode":"                + dir.toString());\n    }\n    return files;\n  }\n\n  /**\n   * A wrapper for {@link File#list()}. This java.io API returns null\n   * when a dir is not a directory or for any I/O error. Instead of having\n   * null check everywhere File#list() is used, we will add utility API\n   * to get around this problem. For the majority of cases where we prefer\n   * an IOException to be thrown.\n   * @param dir directory for which listing should be performed\n   * @return list of file names or empty string list\n   * @exception AccessDeniedException for unreadable directory\n   * @exception IOException for invalid directory or for bad disk\n   */\n  public static String[] list(File dir) throws IOException {\n    if (!canRead(dir)) {\n      throw new AccessDeniedException(dir.toString(), null,\n          FSExceptionMessages.PERMISSION_DENIED);\n    }\n    String[] fileNames = dir.list();\n    if(fileNames == null) {\n      throw new IOException(\"Invalid directory or I/O error occurred for dir: \"\n                + dir.toString());\n    }\n    return fileNames;\n  }\n\n  public static String[] createJarWithClassPath(String inputClassPath, Path pwd,\n      Map<String, String> callerEnv) throws IOException {\n    return createJarWithClassPath(inputClassPath, pwd, pwd, callerEnv);\n  }\n\n  /**\n   * Create a jar file at the given path, containing a manifest with a classpath\n   * that references all specified entries.","sourceCodeStart":1603,"sourceCodeEnd":1639,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java#L1603-L1639","documentation":"Error \"Permission denied\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java:1621 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check file/directory permissions and ownership for the current user.","Use chmod/chown or run as a privileged user to gain access."],"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"}