{"record":{"id":"783366edc5999fc1","repo":"apache/hadoop","slug":"path-no-such-file-or-directory","errorCode":null,"errorMessage":"{path}: No such file or directory!","messagePattern":"(.+?): No such file or directory!","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java","lineNumber":291,"sourceCode":"    ObjectMetadata meta = store.getObjectMetadata(key);\n    // If key not found and key does not end with \"/\"\n    if (meta == null && !key.endsWith(\"/\")) {\n      // In case of 'dir + \"/\"'\n      key += \"/\";\n      meta = store.getObjectMetadata(key);\n    }\n    if (meta == null) {\n      OSSListRequest listRequest = store.createListObjectsRequest(key,\n          maxKeys, null, null, false);\n      OSSListResult listing = store.listObjects(listRequest);\n      do {\n        if (CollectionUtils.isNotEmpty(listing.getObjectSummaries()) ||\n            CollectionUtils.isNotEmpty(listing.getCommonPrefixes())) {\n          return new OSSFileStatus(0, true, 1, 0, 0, qualifiedPath, username);\n        } else if (listing.isTruncated()) {\n          listing = store.continueListObjects(listRequest, listing);\n        } else {\n          throw new FileNotFoundException(\n              path + \": No such file or directory!\");\n        }\n      } while (true);\n    } else if (objectRepresentsDirectory(key, meta.getContentLength())) {\n      return new OSSFileStatus(0, true, 1, 0, meta.getLastModified().getTime(),\n          qualifiedPath, username);\n    } else {\n      return new OSSFileStatus(meta.getContentLength(), false, 1,\n          getDefaultBlockSize(path), meta.getLastModified().getTime(),\n          qualifiedPath, username);\n    }\n  }\n\n  @Override\n  public String getScheme() {\n    return \"oss\";\n  }\n","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/AliyunOSSFileSystem.java#L273-L309","documentation":"Thrown by AliyunOSSFileSystem.getFileStatus(): no object metadata exists for the key (meta == null), and a listing under that prefix returned neither object summaries nor common prefixes through the final (non-truncated) page. The connector therefore concludes nothing exists at the path and throws FileNotFoundException(path + \": No such file or directory!\").","triggerScenarios":"Calling getFileStatus, open, rename source, delete, or listStatus on a path whose key has no object and no children; reading output before the writer committed (committers often make files visible only at commit); typo'd bucket/prefix in the URL.","commonSituations":"Race where a reader queries a path a concurrent job has not yet created; wrong fs.oss.endpoint or bucket so listings target the wrong store; keys created outside Hadoop with different prefix conventions; FileOutputCommitter v1 semantics hiding output until task commit.","solutions":["Verify the path exists first with fs.exists(path) (which uses the same listing) and fix the URL/bucket/prefix typos","If reading job output, wait for the job/commit to finish before opening the file","Confirm fs.oss.endpoint and bucket name are correct by listing the parent directory"],"exampleFix":"// before\nFSDataInputStream in = fs.open(new Path(\"oss://bucket/missing\"));\n\n// after\nPath p = new Path(\"oss://bucket/missing\");\nif (!fs.exists(p)) {\n  throw new FileNotFoundException(\"Output not committed yet: \" + p);\n}\nFSDataInputStream in = fs.open(p);","handlingStrategy":"try-catch","validationCode":"if (!fs.exists(path)) {\n  throw new FileNotFoundException(\"Path absent (not yet committed or wrong prefix): \" + path);\n}","typeGuard":null,"tryCatchPattern":"catch (FileNotFoundException e) { /* expected during racing reads: poll exists() or wait for job completion, do not retry open() blindly */ }","preventionTips":["Gate reads on job/commit completion before opening output paths","Validate bucket and endpoint config with a listStatus of the parent before first read","Use exists() (same listing semantics) for cheap pre-checks"],"tags":["aliyun-oss","file-not-found","path-resolution","hadoop-connector"],"backgroundTag":"object-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}