{"record":{"id":"b80dd6651f981de0","repo":"apache/hadoop","slug":"filename-not-found","errorCode":null,"errorMessage":"${fileName} not found.","messagePattern":"(.+?) not found\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HardLink.java","lineNumber":244,"sourceCode":"      LOG.warn(\"Failed to determine if hardlink is supported\", e);\n      return false;\n    }\n  }\n\n   /**\n   * Retrieves the number of links to the specified file.\n    *\n    * @param fileName file name.\n    * @throws IOException raised on errors performing I/O.\n    * @return link count.\n   */\n  public static int getLinkCount(File fileName) throws IOException {\n    if (fileName == null) {\n      throw new IOException(\n          \"invalid argument to getLinkCount: file name is null\");\n    }\n    if (!fileName.exists()) {\n      throw new FileNotFoundException(fileName + \" not found.\");\n    }\n\n    if (supportsHardLink(fileName)) {\n      return (int) Files.getAttribute(fileName.toPath(), FILE_ATTRIBUTE);\n    }\n\n    // construct and execute shell command\n    String[] cmd = getHardLinkCommand.linkCount(fileName);\n    String inpMsg = null;\n    String errMsg = null;\n    int exitValue = -1;\n    BufferedReader in = null;\n\n    ShellCommandExecutor shexec = new ShellCommandExecutor(cmd);\n    try {\n      shexec.execute();\n      in = new BufferedReader(new StringReader(shexec.getOutput()));\n      inpMsg = in.readLine();","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HardLink.java#L226-L262","documentation":"Error \"${fileName} not found.\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HardLink.java:244 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify ${fileName} exists before calling getLinkCount.","Check for path typos or a race with file deletion."],"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-23T01:17:44.959Z"}