{"record":{"id":"d7c2ec051e992dfb","repo":"apache/hadoop","slug":"no-such-file-or-directory-s","errorCode":null,"errorMessage":"No such file or directory: %s","messagePattern":"No such file or directory: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/RawFileSystem.java","lineNumber":523,"sourceCode":"      throw new FileNotFoundException(e.getMessage());\n    }\n  }\n\n\n  /**\n   * Get the file status of given path.\n   *\n   * @param f the path\n   * @return {@link RawFileStatus} describe file status info.\n   * @throws FileNotFoundException       if the path doesn't exist.\n   * @throws ParentNotDirectoryException if the path is locating under an existing file, which is\n   *                                     not allowed in directory bucket case.\n   */\n  RawFileStatus innerFileStatus(Path f) throws ParentNotDirectoryException, FileNotFoundException {\n    Path qualifiedPath = f.makeQualified(uri, workingDir);\n    RawFileStatus fileStatus = getFileStatusOrNull(qualifiedPath);\n    if (fileStatus == null) {\n      throw new FileNotFoundException(\n          String.format(\"No such file or directory: %s\", qualifiedPath));\n    }\n    return fileStatus;\n  }\n\n  /**\n   * The different with {@link RawFileSystem#getFileStatus(Path)} is that:\n   * 1. throw  {@link ParentNotDirectoryException} if the path is locating under an existing file in\n   * directory bucket case, but {@link RawFileSystem#getFileStatus(Path)} will ignore whether the\n   * invalid path and throw {@link FileNotFoundException}\n   * 2. return null if the path doesn't exist instead of throwing {@link FileNotFoundException}.\n   *\n   * @param path the object path.\n   * @return null if the path doesn't exist.\n   * @throws ParentNotDirectoryException if the path is locating under an existing file, which is\n   *                                     not allowed in directory bucket case.\n   */\n  public RawFileStatus getFileStatusOrNull(final Path path) throws ParentNotDirectoryException {","sourceCodeStart":505,"sourceCodeEnd":541,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/RawFileSystem.java#L505-L541","documentation":"innerFileStatus() throws FileNotFoundException(\"No such file or directory: <qualifiedPath>\") when getFileStatusOrNull returns null, i.e. no object or directory marker exists at the key. This is the primary 'path does not exist' signal of RawFileSystem and escapes through getFileStatus, open, delete, listStatus and rename source checks.","triggerScenarios":"fs.open(p), fs.getFileStatus(p), fs.delete(p, ...) or rename with src=p on a tos:// path whose object key does not exist (and is not the root); paths whose working-directory qualification resolves elsewhere than expected.","commonSituations":"Reading output of a job that failed or wrote to a different directory; wrong bucket/prefix in the URI; eventual-consistency lag between write and read in other stores (TOS is strong-consistent, so this usually means a genuine typo/path bug); relative paths resolved against /user/<name> working directory.","solutions":["Verify the full qualified path (makeQualified / fs.getWorkingDirectory) and bucket spelling","Check existence first: fs.exists(p) or fs.getFileStatusOrNull(p) (public on RawFileSystem) returning null","In recovery code, catch FileNotFoundException and retry/skip with backoff for eventually-produced files","List the parent directory to see what actually exists: fs.listStatus(p.getParent())"],"exampleFix":"// before\nFSDataInputStream in = fs.open(new Path(\"out/part-0\")); // FileNotFoundException if absent\n\n// after\nPath p = new Path(\"out/part-0\");\nif (fs.exists(p)) { try (FSDataInputStream in = fs.open(p)) { ... } }","handlingStrategy":"try-catch","validationCode":"if (fs.exists(p)) {\n  try (FSDataInputStream in = fs.open(p)) { /* read */ }\n}","typeGuard":null,"tryCatchPattern":"try (FSDataInputStream in = fs.open(p)) { /* read */ }\ncatch (FileNotFoundException e) {\n  // missing: log qualified path, verify bucket/prefix, skip or produce empty result\n}","preventionTips":["Log the makeQualified() path on failure to catch working-directory surprises","Verify bucket and prefix spelling before batch jobs","For cross-job handoffs, gate on _SUCCESS existence rather than polling data files"],"tags":["file-not-found","missing-object","path-resolution","tos"],"backgroundTag":"file-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}