{"record":{"id":"b0d45c69e99475ee","repo":"apache/hadoop","slug":"file-not-found","errorCode":null,"errorMessage":"File {} not found.","messagePattern":"File (.+?) not found\\.","errorType":"http","errorClass":"FileNotFoundException","httpStatus":404,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java","lineNumber":322,"sourceCode":"            host.substring(0, idx), Integer.parseInt(host.substring(idx + 1)));\n        }\n\n        if (excludeNode != null) {\n          excludes.add(excludeNode);\n        } else {\n          LOG.debug(\"DataNode {} was requested to be excluded, \"\n                + \"but it was not found.\", host);\n        }\n      }\n    }\n\n    // For these operations choose a datanode containing a replica\n    if (op == GetOpParam.Op.OPEN\n        || op == GetOpParam.Op.GETFILECHECKSUM\n        || op == PostOpParam.Op.APPEND) {\n      final NamenodeProtocols np = getRPCServer(namenode);\n      if (status == null) {\n        throw new FileNotFoundException(\"File \" + path + \" not found.\");\n      }\n\n      final long len = status.getLen();\n      if (op == GetOpParam.Op.OPEN) {\n        if (openOffset < 0L || (openOffset >= len && len > 0)) {\n          throw new IOException(\"Offset=\" + openOffset\n              + \" out of the range [0, \" + len + \"); \" + op + \", path=\" + path);\n        }\n      }\n\n      if (len > 0) {\n        final long offset = op == GetOpParam.Op.OPEN? openOffset: len - 1;\n        final LocatedBlocks locations = np.getBlockLocations(path, offset, 1);\n        final int count = locations.locatedBlockCount();\n        if (count > 0) {\n          return bestNode(locations.get(0).getLocations(), excludes);\n        } else {\n          throw new IOException(\"Block could not be located. Path=\" + path + \", offset=\" + offset);","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java#L304-L340","documentation":"Error \"File {} not found.\" thrown in apache/hadoop.","triggerScenarios":"A WebHDFS read/open targets a path that does not exist.","commonSituations":"Reading a file that was deleted or never created, or a URL path typo.","solutions":["Verify the file path exists (check spelling and parent directories) before the WebHDFS open/read operation."],"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"}