{"record":{"id":"38ff7c277b012e4a","repo":"apache/hadoop","slug":"can-not-open-a-folder","errorCode":null,"errorMessage":"Can not open a folder","messagePattern":"Can not open a folder","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java","lineNumber":702,"sourceCode":"        this.store.getEnvGroupName());\n    return true;\n  }\n\n  @Override\n  public FSDataInputStream open(Path f, int bufferSize)\n      throws IOException {\n    Path absolutePath = makeAbsolute(f);\n    String key = pathToKey(absolutePath);\n\n    FileMetadata fileMetaData = null;\n    try {\n      fileMetaData = store.retrieveMetadata(key);\n    } catch (FileNotFoundException ignore) {\n      throw new FileNotFoundException(f.toString());\n    }\n\n    if (fileMetaData.isFolder()) {\n      throw new FileNotFoundException(\"Can not open a folder\");\n    }\n\n    BosInputStream bosFsInputStream = new BosInputStream(\n        key, fileMetaData, this.store, this.statistics);\n\n    bosFsInputStream.setReadahead(this.readAhead);\n    return new FSDataInputStream(\n        new BufferedFSInputStream(\n            bosFsInputStream, this.readBufferSize));\n  }\n\n  private void createParent(Path path) throws IOException {\n    Path parent = path.getParent();\n    if (parent != null) {\n      String key = pathToKey(makeAbsolute(parent));\n      if (key.length() > 0) {\n        if (!store.isDirectory(key)) {\n          LOG.warn(\"create parent when rename or delete, \"","sourceCodeStart":684,"sourceCodeEnd":720,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java#L684-L720","documentation":"TaskAttemptInfo's constructor accepts only State.SUCCEEDED or State.FAILED; any other State (null, State.KILLED, or a raw enum value) throws IllegalArgumentException with 'status cannot be <state>'. This is the base object model behind MapTaskAttemptInfo/ReduceTaskAttemptInfo that ZombieJob returns to simulators like Mumak, and it encodes the assumption that only finished-with-outcome attempts get modeled. Note the asymmetry: ZombieJob.convertState() can produce State.KILLED, so a KILLED attempt routed into one of these constructors is the classic trigger.","triggerScenarios":"new MapTaskAttemptInfo(State.KILLED, taskInfo, runtime) or any subclass constructor with state KILLED/null; ZombieJob.makeUpTaskAttemptInfo() or custom JobStory implementations passing convertState(attempt.getResult()) where the result was KILLED.","commonSituations":"Writing a custom JobStory for the simulator that forwards every attempt's state, including killed ones; upgrading from code paths where killed attempts were filtered earlier and now reach the constructor.","solutions":["Map killed attempts to a made-up SUCCEEDED/FAILED modeling (as ZombieJob does: it substitutes synthesized statistics for KILLED attempts instead of constructing an attempt info with State.KILLED).","Null-check and whitelist the state before constructing: only pass SUCCEEDED or FAILED.","Filter attempts with result KILLED/unknown before they reach TaskAttemptInfo creation, logging them for traceability."],"exampleFix":"// before\nState st = ZombieJob.convertState(attempt.getResult()); // may be KILLED\nreturn new MapTaskAttemptInfo(st, taskInfo, runtime); // throws for KILLED\n\n// after\nif (st != State.SUCCEEDED && st != State.FAILED) {\n  LOG.warn(\"Skipping attempt with state \" + st);\n  return makeUpAttemptFromStatistics(taskInfo); // or skip\n}\nreturn new MapTaskAttemptInfo(st, taskInfo, runtime);","handlingStrategy":"validation","validationCode":"static boolean isModelableState(org.apache.hadoop.mapreduce.jobhistory.State s) {\n  return s == org.apache.hadoop.mapreduce.jobhistory.State.SUCCEEDED\n      || s == org.apache.hadoop.mapreduce.jobhistory.State.FAILED;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whitelist states to SUCCEEDED/FAILED before constructing TaskAttemptInfo subclasses.","Route KILLED attempts to synthesized statistics (as ZombieJob does) rather than the constructor.","Add unit tests covering KILLED and null states in custom JobStory implementations."],"tags":["hadoop","rumen","task-attempt","enum-validation","state-machine"],"backgroundTag":"invalid-enum-state","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}