{"record":{"id":"20fc933151a3d45b","repo":"apache/hadoop","slug":"src-tostring-permission-denied","errorCode":null,"errorMessage":"src.toString() + \": Permission denied\"","messagePattern":"src\\.toString\\(\\) \\+ \": Permission denied\"","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java","lineNumber":545,"sourceCode":"      File contents[] = listFiles(src);\n      for (int i = 0; i < contents.length; i++) {\n        copy(contents[i], dstFS, new Path(dst, contents[i].getName()),\n             deleteSource, conf);\n      }\n    } else if (src.isFile()) {\n      InputStream in = null;\n      OutputStream out =null;\n      try {\n        in = Files.newInputStream(src.toPath());\n        out = dstFS.create(dst);\n        IOUtils.copyBytes(in, out, conf);\n      } catch (IOException e) {\n        IOUtils.closeStream( out );\n        IOUtils.closeStream( in );\n        throw e;\n      }\n    } else if (!src.canRead()) {\n      throw new IOException(src.toString() +\n                            \": Permission denied\");\n\n    } else {\n      throw new IOException(src.toString() +\n                            \": No such file or directory\");\n    }\n    if (deleteSource) {\n      return FileUtil.fullyDelete(src);\n    } else {\n      return true;\n    }\n  }\n\n  /**\n   * Copy FileSystem files to local files.\n   *\n   * @param srcFS srcFs.\n   * @param src src.","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java#L527-L563","documentation":"Error \"src.toString() + \": Permission denied\"\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java:545 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Grant read/execute permission on the source file and its parent directories to the current user.","Run the operation as a user with sufficient privileges or adjust ACLs."],"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"}