apache/hadoop · error · FileNotFoundException

Can not open a folder

Error message

Can not open a folder

What it means

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.

Source

Thrown at hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java:702

        this.store.getEnvGroupName());
    return true;
  }

  @Override
  public FSDataInputStream open(Path f, int bufferSize)
      throws IOException {
    Path absolutePath = makeAbsolute(f);
    String key = pathToKey(absolutePath);

    FileMetadata fileMetaData = null;
    try {
      fileMetaData = store.retrieveMetadata(key);
    } catch (FileNotFoundException ignore) {
      throw new FileNotFoundException(f.toString());
    }

    if (fileMetaData.isFolder()) {
      throw new FileNotFoundException("Can not open a folder");
    }

    BosInputStream bosFsInputStream = new BosInputStream(
        key, fileMetaData, this.store, this.statistics);

    bosFsInputStream.setReadahead(this.readAhead);
    return new FSDataInputStream(
        new BufferedFSInputStream(
            bosFsInputStream, this.readBufferSize));
  }

  private void createParent(Path path) throws IOException {
    Path parent = path.getParent();
    if (parent != null) {
      String key = pathToKey(makeAbsolute(parent));
      if (key.length() > 0) {
        if (!store.isDirectory(key)) {
          LOG.warn("create parent when rename or delete, "

View on GitHub (pinned to 2add963021)

Solutions

  1. 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).
  2. Null-check and whitelist the state before constructing: only pass SUCCEEDED or FAILED.
  3. Filter attempts with result KILLED/unknown before they reach TaskAttemptInfo creation, logging them for traceability.

Example fix

// before
State st = ZombieJob.convertState(attempt.getResult()); // may be KILLED
return new MapTaskAttemptInfo(st, taskInfo, runtime); // throws for KILLED

// after
if (st != State.SUCCEEDED && st != State.FAILED) {
  LOG.warn("Skipping attempt with state " + st);
  return makeUpAttemptFromStatistics(taskInfo); // or skip
}
return new MapTaskAttemptInfo(st, taskInfo, runtime);
Defensive patterns

Strategy: validation

Validate before calling

static boolean isModelableState(org.apache.hadoop.mapreduce.jobhistory.State s) {
  return s == org.apache.hadoop.mapreduce.jobhistory.State.SUCCEEDED
      || s == org.apache.hadoop.mapreduce.jobhistory.State.FAILED;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/38ff7c277b012e4a. Report an issue: GitHub.