{"record":{"id":"156ca0a48b63bad0","repo":"apache/hadoop","slug":"file-does-not-exist-in","errorCode":null,"errorMessage":"File: {} does not exist in {}","messagePattern":"File: (.+?) does not exist in (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java","lineNumber":656,"sourceCode":"   * @throws IOException raised on errors performing I/O.\n   */\n  @Override\n  public FileStatus getFileStatus(Path f) throws IOException {\n    HarStatus hstatus = getFileHarStatus(f);\n    return toFileStatus(hstatus);\n  }\n\n  private HarStatus getFileHarStatus(Path f) throws IOException {\n    // get the fs DataInputStream for the underlying file\n    // look up the index.\n    Path p = makeQualified(f);\n    Path harPath = getPathInHar(p);\n    if (harPath == null) {\n      throw new IOException(\"Invalid file name: \" + f + \" in \" + uri);\n    }\n    HarStatus hstatus = metadata.archive.get(harPath);\n    if (hstatus == null) {\n      throw new FileNotFoundException(\"File: \" +  f + \" does not exist in \" + uri);\n    }\n    return hstatus;\n  }\n\n  @Override\n  public void msync() throws IOException, UnsupportedOperationException {\n    fs.msync();\n  }\n\n  /**\n   * @return null since no checksum algorithm is implemented.\n   */\n  @Override\n  public FileChecksum getFileChecksum(Path f, long length) {\n    return null;\n  }\n\n  /**","sourceCodeStart":638,"sourceCodeEnd":674,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java#L638-L674","documentation":"The path translated into archive-relative form, but metadata.archive.get(harPath) — the in-memory index parsed from _masterindex/_index — has no entry for it. Archive membership is frozen when `hadoop archive` ran; anything not in the index does not exist in the har namespace, even if a file with that name exists in the underlying directory.","triggerScenarios":"getFileStatus/open/exists on a name that is not an index entry: a typo in a segment, the wrong sub-directory, a file created in the source tree after the archive was built, or assuming membership because the file exists on the underlying filesystem.","commonSituations":"Stale archive versus a source directory that kept changing; path spelling/case mistakes; consumers pointed at the wrong .har version or wrong path-inside-archive.","solutions":["List the parent directory with fs.listStatus(parent) to see the exact names present in the archive index","If files were added after archiving, rebuild with `hadoop archive -archiveName data.har -p <srcDir> <destDir>`","Verify the archive-path portion of the URI points at the intended .har"],"exampleFix":"// before\nfs.open(new Path(\"har://hdfs-nn:8020/a/data.har/utls/report.csv\")); // typo: 'utls'\n\n// after\nfor (FileStatus s : fs.listStatus(new Path(\"har://hdfs-nn:8020/a/data.har/utils\"))) {\n  System.out.println(s.getPath()); // use the exact listed name\n}","handlingStrategy":"try-catch","validationCode":"Path parent = path.getParent();\nboolean present = false;\nfor (FileStatus s : fs.listStatus(parent)) {\n  if (s.getPath().getName().equals(path.getName())) { present = true; break; }\n}\nif (!present) { /* handle missing member */ }","typeGuard":null,"tryCatchPattern":"try {\n  fs.getFileStatus(p);\n} catch (FileNotFoundException e) {\n  // member not in the archive index: treat as absent, log with archive URI\n}","preventionTips":["Treat FileNotFoundException as the supported 'does not exist' signal on har paths","Derive member names from listStatus output instead of hard-coded strings","Rebuild archives whenever the source tree changes; never assume source and archive stay in sync"],"tags":["hadoop","har-filesystem","file-not-found","archive-index"],"backgroundTag":"file-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}